C Reference Card (ANSI) 2.2

PDF-файл C Reference Card (ANSI) 2.2 Алгоритмы и алгоритмические языки (36073): Другое - 1 семестрC Reference Card (ANSI) 2.2: Алгоритмы и алгоритмические языки - PDF (36073) - СтудИзба2019-04-24СтудИзба

Описание файла

PDF-файл из архива "C Reference Card (ANSI) 2.2", который расположен в категории "". Всё это находится в предмете "алгоритмы и алгоритмические языки" из 1 семестр, которые можно найти в файловом архиве МГУ им. Ломоносова. Не смотря на прямую связь этого архива с МГУ им. Ломоносова, его также можно найти и в других разделах. .

Просмотр PDF-файла онлайн

Текст из PDF

C Reference Card (ANSI)ConstantsFlow of Controlsuffix: long, unsigned, float65536L, -1U, 3.0FProgram Structure/Functionsexponential form4.2e1prefix: octal, hexadecimal0, 0x or 0Xtype fnc(type 1 , . . . );function prototypeExample. 031 is 25, 0x31 is 49 decimaltype name;variable declarationcharacter constant (char, octal, hex)'a', '\ooo', '\xhh'int main(void) {main routine\n, \r, \t, \bdeclarationslocal variable declarations newline, cr, tab, backspacespecial characters\\, \?, \', \"statementsstring constant (ends with '\0')"abc. .

. de"}type fnc(arg 1 , . . . ) {function definitiondeclarationslocal variable declarations Pointers, Arrays & Structuresstatementsdeclare pointer to typetype *name;return value;declare function returning pointer to type type *f();}declare pointer to function returning type type (*pf)();/* */commentsgeneric pointer typevoid *int main(int argc, char *argv[])main with argsnull pointer constantNULLexit(arg);terminate executionobject pointed to by pointer*pointeraddress of object name&nameC Preprocessorarrayname[dim]include library file#include <filename>multi-dim arrayname[dim 1 ][dim 2 ].

. .include user file#include "filename"Structuresreplacement text#define name textstruct tag {structure templatereplacement macro#define name(var ) textdeclarationsdeclaration of membersExample. #define max(A,B) ((A)>(B) ? (A) : (B))};undefine#undef namecreate structurestruct tag namequoted string in replace#member of structure from templatename.memberExample. #define msg(A) printf("%s = %d", #A, (A))member of pointed-to structurepointer -> memberconcatenate args and rescan##Example.

(*p).x and p->x are the sameconditional execution#if, #else, #elif, #endifsingle object, multiple possible typesunionis name defined, not defined?#ifdef, #ifndefbit field with b bitsunsigned member : b;name defined?defined(name)line continuation char\Operators (grouped by precedence)Data Types/Declarationscharacter (1 byte)charintegerintreal number (single, double precision)float, doubleshort (16 bit integer)shortlong (32 bit integer)longdouble long (64 bit integer)long longpositive or negativesignednon-negative modulo 2munsignedpointer to int, float,.

. .int*, float*,. . .enumeration constantenum tag {name 1 =value 1 ,. . . };constant (read-only) valuetype const name;declare external variableexterninternal to source filestaticlocal persistent between callsstaticno valuevoidstructurestruct tag {. . . };create new name for data typetypedef type name;size of an object (type is size_t)sizeof objectsize of a data type (type is size_t)sizeof(type)Initializationinitialize variableinitialize arrayinitialize char stringtype name=value;type name[]={value 1 ,. . . };char name[]="string";c 2007 Joseph H.

Silverman Permissions on back. v2.2°statement terminator;block delimiters{ }exit from switch, while, do, forbreak;next iteration of while, do, forcontinue;go togoto label;labellabel: statementreturn value from functionreturn exprFlow Constructionsif statementif (expr 1 ) statement 1else if (expr 2 ) statement 2else statement 3while statementwhile (expr )statementfor statementfor (expr 1 ; expr 2 ; expr 3 )statementdo statementdostatementwhile(expr );switch statementswitch (expr ) {case const 1 : statement 1 break;case const 2 : statement 2 break;default: statement}ANSI Standard Libraries<assert.h><locale.h><stddef.h><ctype.h><math.h><stdio.h><errno.h><setjmp.h><stdlib.h><float.h><signal.h><string.h>Character Class Tests <ctype.h>struct member operatorstruct member through pointerincrement, decrementplus, minus, logical not, bitwise notindirection via pointer, address of objectcast expression to typesize of an objectname.memberpointer ->member++, -+, -, !, ~*pointer , &name(type) exprsizeofmultiply, divide, modulus (remainder)*, /, %add, subtract+, -alphanumeric?alphabetic?control character?decimal digit?printing character (not incl space)?lower case letter?printing character (incl space)?printing char except space, letter, digit?space, formfeed, newline, cr, tab, vtab?upper case letter?hexadecimal digit?convert to lower caseconvert to upper caseleft, right shift [bit ops]<<, >>String Operations <string.h>relational comparisonsequality comparisons>, >=, <, <===, !=and [bit op]&exclusive or [bit op]^or (inclusive) [bit op]|logical and&&logical or||conditional expressionexpr 1 ? expr 2 : expr 3assignment operators+=, -=, *=, .

. .expression evaluation separator,Unary operators, conditional expression and assignment operators group right to left; all others group left to right.<limits.h><stdarg.h><time.h>isalnum(c)isalpha(c)iscntrl(c)isdigit(c)isgraph(c)islower(c)isprint(c)ispunct(c)isspace(c)isupper(c)isxdigit(c)tolower(c)toupper(c)s is a string; cs, ct are constant stringslength of scopy ct to sconcatenate ct after scompare cs to ctonly first n charspointer to first c in cspointer to last c in cscopy n chars from ct to scopy n chars from ct to s (may overlap)compare n chars of cs with ctpointer to first c in first n chars of csput c into first n chars of sstrlen(s)strcpy(s,ct)strcat(s,ct)strcmp(cs,ct)strncmp(cs,ct,n)strchr(cs,c)strrchr(cs,c)memcpy(s,ct,n)memmove(s,ct,n)memcmp(cs,ct,n)memchr(cs,c,n)memset(s,c,n)C Reference Card (ANSI)Input/Output <stdio.h>Standard I/Ostandard input streamstdinstandard output streamstdoutstandard error streamstderrend of file (type is int)EOFget a charactergetchar()print a characterputchar(chr )print formatted dataprintf("format",arg 1 ,.

. . )print to string ssprintf(s,"format",arg 1 ,. . . )read formatted datascanf("format",&name 1 ,. . . )read from string ssscanf(s,"format",&name 1 ,. . . )print string sputs(s)File I/Odeclare file pointerFILE *fp;pointer to named filefopen("name","mode")modes: r (read), w (write), a (append), b (binary)get a charactergetc(fp)write a characterputc(chr ,fp)write to filefprintf(fp,"format",arg 1 ,. . . )read from filefscanf(fp,"format",arg 1 ,.

. . )read and store n elts to *ptrfread(*ptr,eltsize,n,fp)write n elts from *ptr to filefwrite(*ptr,eltsize,n,fp)close filefclose(fp)non-zero if errorferror(fp)non-zero if already reached EOFfeof(fp)read line to string s (< max chars)fgets(s,max,fp)write string sfputs(s,fp)Codes for Formatted I/O: "%-+ 0w.pmc"- left justify+ print with signspace print space if no sign0 pad with leading zerosw min field widthp precisionm conversion character:h short,l long,L long doublecconversion character:d,i integeru unsignedc single chars char stringf double (printf)e,E exponentialf float (scanf)lf double (scanf)o octalx,X hexadecimalp pointern number of chars writteng,G same as f or e,E depending on exponentVariable Argument Lists <stdarg.h>declaration of pointer to argumentsva_list ap;initialization of argument pointerva_start(ap,lastarg);lastarg is last named parameter of the functionaccess next unnamed arg, update pointer va_arg(ap,type)call before exiting functionva_end(ap);Standard Utility Functions <stdlib.h>absolute value of int nabs(n)absolute value of long nlabs(n)quotient and remainder of ints n,ddiv(n,d)returns structure with div_t.quot and div_t.remquotient and remainder of longs n,dldiv(n,d)returns structure with ldiv_t.quot and ldiv_t.rempseudo-random integer [0,RAND_MAX]rand()set random seed to nsrand(n)terminate program executionexit(status)pass string s to system for executionsystem(s)Conversionsconvert string s to doubleatof(s)convert string s to integeratoi(s)convert string s to longatol(s)convert prefix of s to doublestrtod(s,&endp)convert prefix of s (base b) to longstrtol(s,&endp,b)same, but unsigned longstrtoul(s,&endp,b)Storage Allocationallocate storagemalloc(size), calloc(nobj,size)change size of storagenewptr = realloc(ptr,size);deallocate storagefree(ptr);Array Functionssearch array for keybsearch(key,array,n,size,cmpf)sort array ascending orderqsort(array,n,size,cmpf)Time and Date Functions <time.h>processor time used by programclock()Example.

clock()/CLOCKS_PER_SEC is time in secondscurrent calendar timetime()time2 -time1 in seconds (double)difftime(time2 ,time1 )arithmetic types representing timesclock_t,time_tstructure type for calendar time compsstruct tmtm_secseconds after minutetm_minminutes after hourtm_hourhours since midnighttm_mdayday of monthtm_monmonths since Januarytm_yearyears since 1900tm_wdaydays since Sundaytm_ydaydays since January 1tm_isdstDaylight Savings Time flagconvert local time to calendar timemktime(tp)convert time in tp to stringasctime(tp)convert calendar time in tp to local time ctime(tp)convert calendar time to GMTgmtime(tp)convert calendar time to local timelocaltime(tp)format date and time infostrftime(s,smax,"format",tp)tp is a pointer to a structure of type tmMathematical Functions <math.h>Arguments and returned values are doubletrig functionsinverse trig functionsarctan(y/x)hyperbolic trig functionsexponentials & logsexponentials & logs (2 power)division & remainderpowers (float)roundingsin(x), cos(x), tan(x)asin(x), acos(x), atan(x)atan2(y,x)sinh(x), cosh(x), tanh(x)exp(x), log(x), log10(x)ldexp(x,n), frexp(x,&e)modf(x,ip), fmod(x,y)pow(x,y), sqrt(x)ceil(x), floor(x), fabs(x)Integer Type Limits <limits.h>The numbers given in parentheses are typical values for theconstants on a 32-bit Unix system, followed by minimum required values (if significantly different).CHAR_BIT bits in char(8)CHAR_MAX max value of char(SCHAR_MAX or UCHAR_MAX)CHAR_MIN min value of char(SCHAR MIN or 0)SCHAR_MAX max signed char(+127)SCHAR_MIN min signed char(−128)SHRT_MAX max value of short(+32,767)SHRT_MIN min value of short(−32,768)INT_MAX max value of int(+2,147,483,647) (+32,767)INT_MIN min value of int(−2,147,483,648) (−32,767)LONG_MAX max value of long(+2,147,483,647)LONG_MIN min value of long(−2,147,483,648)UCHAR_MAX max unsigned char(255)USHRT_MAX max unsigned short(65,535)UINT_MAX max unsigned int(4,294,967,295) (65,535)ULONG_MAX max unsigned long(4,294,967,295)Float Type Limits <float.h>The numbers given in parentheses are typical values for theconstants on a 32-bit Unix system.FLT_RADIXradix of exponent rep(2)FLT_ROUNDSfloating point rounding modeFLT_DIGdecimal digits of precision(6)FLT_EPSILONsmallest x so 1.0f + x 6= 1.0f(1.1E − 7)FLT_MANT_DIG number of digits in mantissaFLT_MAXmaximum float number(3.4E38)FLT_MAX_EXPmaximum exponentFLT_MINminimum float number(1.2E − 38)FLT_MIN_EXPminimum exponentDBL_DIGdecimal digits of precision(15)DBL_EPSILONsmallest x so 1.0 + x 6= 1.0(2.2E − 16)DBL_MANT_DIG number of digits in mantissaDBL_MAXmax double number(1.8E308)DBL_MAX_EXPmaximum exponentDBL_MINmin double number(2.2E − 308)DBL_MIN_EXPminimum exponentc 2007 Joseph H.

SilvermanJanuary 2007 v2.2. Copyright °Permission is granted to make and distribute copies of this card provided the copyright notice and this permission notice are preserved onall copies.Send comments and corrections to J.H. Silverman, Math. Dept., BrownUniv., Providence, RI 02912 USA. hjhs@math.brown.edui.

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