Главная » Просмотр файлов » Стандарт языка Си С99 TC

Стандарт языка Си С99 TC (1113411), страница 60

Файл №1113411 Стандарт языка Си С99 TC (Стандарт языка Си С99 + TC) 60 страницаСтандарт языка Си С99 TC (1113411) страница 602019-04-24СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 60)

If theresult cannot be represented, the behavior is undefined.265)Returns3The abs, labs, and llabs, functions return the absolute value.7.20.6.2 The div, ldiv, and lldiv functionsSynopsis1#include <stdlib.h>div_t div(int numer, int denom);ldiv_t ldiv(long int numer, long int denom);lldiv_t lldiv(long long int numer, long long int denom);Description2The div, ldiv, and lldiv, functions compute numer / denom and numer %denom in a single operation.Returns3The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, andlldiv_t, respectively, comprising both the quotient and the remainder.

The structuresshall contain (in either order) the members quot (the quotient) and rem (the remainder),each of which has the same type as the arguments numer and denom. If either part ofthe result cannot be represented, the behavior is undefined.265) The absolute value of the most negative number cannot be represented in two’s complement.320Library§7.20.6.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.20.7 Multibyte/wide character conversion functions1The behavior of the multibyte character functions is affected by the LC_CTYPE categoryof the current locale. For a state-dependent encoding, each function is placed into itsinitial conversion state by a call for which its character pointer argument, s, is a nullpointer. Subsequent calls with s as other than a null pointer cause the internal conversionstate of the function to be altered as necessary. A call with s as a null pointer causesthese functions to return a nonzero value if encodings have state dependency, and zerootherwise.266) Changing the LC_CTYPE category causes the conversion state of thesefunctions to be indeterminate.7.20.7.1 The mblen functionSynopsis1#include <stdlib.h>int mblen(const char *s, size_t n);Description2If s is not a null pointer, the mblen function determines the number of bytes containedin the multibyte character pointed to by s.

Except that the conversion state of thembtowc function is not affected, it is equivalent tombtowc((wchar_t *)0, s, n);3The implementation shall behave as if no library function calls the mblen function.Returns4If s is a null pointer, the mblen function returns a nonzero or zero value, if multibytecharacter encodings, respectively, do or do not have state-dependent encodings. If s isnot a null pointer, the mblen function either returns 0 (if s points to the null character),or returns the number of bytes that are contained in the multibyte character (if the next nor fewer bytes form a valid multibyte character), or returns −1 (if they do not form a validmultibyte character).Forward references: the mbtowc function (7.20.7.2).266) If the locale employs special bytes to change the shift state, these bytes do not produce separate widecharacter codes, but are grouped with an adjacent multibyte character.§7.20.7.1Library321ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.20.7.2 The mbtowc functionSynopsis1#include <stdlib.h>int mbtowc(wchar_t * restrict pwc,const char * restrict s,size_t n);Description2If s is not a null pointer, the mbtowc function inspects at most n bytes beginning withthe byte pointed to by s to determine the number of bytes needed to complete the nextmultibyte character (including any shift sequences).

If the function determines that thenext multibyte character is complete and valid, it determines the value of thecorresponding wide character and then, if pwc is not a null pointer, stores that value inthe object pointed to by pwc. If the corresponding wide character is the null widecharacter, the function is left in the initial conversion state.3The implementation shall behave as if no library function calls the mbtowc function.Returns4If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibytecharacter encodings, respectively, do or do not have state-dependent encodings.

If s isnot a null pointer, the mbtowc function either returns 0 (if s points to the null character),or returns the number of bytes that are contained in the converted multibyte character (ifthe next n or fewer bytes form a valid multibyte character), or returns −1 (if they do notform a valid multibyte character).5In no case will the value returned be greater than n or the value of the MB_CUR_MAXmacro.7.20.7.3 The wctomb functionSynopsis1#include <stdlib.h>int wctomb(char *s, wchar_t wc);Description2The wctomb function determines the number of bytes needed to represent the multibytecharacter corresponding to the wide character given by wc (including any shiftsequences), and stores the multibyte character representation in the array whose firstelement is pointed to by s (if s is not a null pointer).

At most MB_CUR_MAX charactersare stored. If wc is a null wide character, a null byte is stored, preceded by any shiftsequence needed to restore the initial shift state, and the function is left in the initialconversion state.322Library§7.20.7.3WG14/N12563Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3The implementation shall behave as if no library function calls the wctomb function.Returns4If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibytecharacter encodings, respectively, do or do not have state-dependent encodings.

If s isnot a null pointer, the wctomb function returns −1 if the value of wc does not correspondto a valid multibyte character, or returns the number of bytes that are contained in themultibyte character corresponding to the value of wc.5In no case will the value returned be greater than the value of the MB_CUR_MAX macro.7.20.8 Multibyte/wide string conversion functions1The behavior of the multibyte string functions is affected by the LC_CTYPE category ofthe current locale.7.20.8.1 The mbstowcs functionSynopsis1#include <stdlib.h>size_t mbstowcs(wchar_t * restrict pwcs,const char * restrict s,size_t n);Description2The mbstowcs function converts a sequence of multibyte characters that begins in theinitial shift state from the array pointed to by s into a sequence of corresponding widecharacters and stores not more than n wide characters into the array pointed to by pwcs.No multibyte characters that follow a null character (which is converted into a null widecharacter) will be examined or converted.

Each multibyte character is converted as if bya call to the mbtowc function, except that the conversion state of the mbtowc function isnot affected.3No more than n elements will be modified in the array pointed to by pwcs. If copyingtakes place between objects that overlap, the behavior is undefined.Returns4If an invalid multibyte character is encountered, the mbstowcs function returns(size_t)(-1). Otherwise, the mbstowcs function returns the number of arrayelements modified, not including a terminating null wide character, if any.267)267) The array will not be null-terminated if the value returned is n.§7.20.8.1Library323ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.20.8.2 The wcstombs functionSynopsis1#include <stdlib.h>size_t wcstombs(char * restrict s,const wchar_t * restrict pwcs,size_t n);Description2The wcstombs function converts a sequence of wide characters from the array pointedto by pwcs into a sequence of corresponding multibyte characters that begins in theinitial shift state, and stores these multibyte characters into the array pointed to by s,stopping if a multibyte character would exceed the limit of n total bytes or if a nullcharacter is stored.

Each wide character is converted as if by a call to the wctombfunction, except that the conversion state of the wctomb function is not affected.3No more than n bytes will be modified in the array pointed to by s. If copying takes placebetween objects that overlap, the behavior is undefined.Returns4If a wide character is encountered that does not correspond to a valid multibyte character,the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs functionreturns the number of bytes modified, not including a terminating null character, ifany.267)324Library§7.20.8.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.21 String handling <string.h>7.21.1 String function conventions1The header <string.h> declares one type and several functions, and defines onemacro useful for manipulating arrays of character type and other objects treated as arraysof character type.268) The type is size_t and the macro is NULL (both described in7.17).

Various methods are used for determining the lengths of the arrays, but in all casesa char * or void * argument points to the initial (lowest addressed) character of thearray. If an array is accessed beyond the end of an object, the behavior is undefined.2Where an argument declared as size_t n specifies the length of the array for afunction, n can have the value zero on a call to that function. Unless explicitly statedotherwise in the description of a particular function in this subclause, pointer argumentson such a call shall still have valid values, as described in 7.1.4. On such a call, afunction that locates a character finds no occurrence, a function that compares twocharacter sequences returns zero, and a function that copies characters copies zerocharacters.3For all functions in this subclause, each character shall be interpreted as if it had the typeunsigned char (and therefore every possible object representation is valid and has adifferent value).7.21.2 Copying functions7.21.2.1 The memcpy functionSynopsis1#include <string.h>void *memcpy(void * restrict s1,const void * restrict s2,size_t n);Description2The memcpy function copies n characters from the object pointed to by s2 into theobject pointed to by s1.

If copying takes place between objects that overlap, the behavioris undefined.Returns3The memcpy function returns the value of s1.268) See ‘‘future library directions’’ (7.26.11).§7.21.2.1Library325ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.21.2.2 The memmove functionSynopsis1#include <string.h>void *memmove(void *s1, const void *s2, size_t n);Description2The memmove function copies n characters from the object pointed to by s2 into theobject pointed to by s1. Copying takes place as if the n characters from the objectpointed to by s2 are first copied into a temporary array of n characters that does notoverlap the objects pointed to by s1 and s2, and then the n characters from thetemporary array are copied into the object pointed to by s1.Returns3The memmove function returns the value of s1.7.21.2.3 The strcpy functionSynopsis1#include <string.h>char *strcpy(char * restrict s1,const char * restrict s2);Description2The strcpy function copies the string pointed to by s2 (including the terminating nullcharacter) into the array pointed to by s1.

If copying takes place between objects thatoverlap, the behavior is undefined.Returns3The strcpy function returns the value of s1.7.21.2.4 The strncpy functionSynopsis1#include <string.h>char *strncpy(char * restrict s1,const char * restrict s2,size_t n);Description2The strncpy function copies not more than n characters (characters that follow a nullcharacter are not copied) from the array pointed to by s2 to the array pointed to by326Library§7.21.2.4WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3s1.269) If copying takes place between objects that overlap, the behavior is undefined.3If the array pointed to by s2 is a string that is shorter than n characters, null charactersare appended to the copy in the array pointed to by s1, until n characters in all have beenwritten.Returns4The strncpy function returns the value of s1.7.21.3 Concatenation functions7.21.3.1 The strcat functionSynopsis1#include <string.h>char *strcat(char * restrict s1,const char * restrict s2);Description2The strcat function appends a copy of the string pointed to by s2 (including theterminating null character) to the end of the string pointed to by s1.

Характеристики

Тип файла
PDF-файл
Размер
3,61 Mb
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6390
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее