Please enable JavaScript.
Coggle requires JavaScript to display documents.
Lect 9 - Strings - Coggle Diagram
Lect 9 - Strings
Text - string
-
initialization char s[5]={'a','b','\0'};
char s[5]={'a','b','\0'};
-
-
-
-
-
Out put of string
-
int i=0; while(s[i]!='\0'){ printf("%c",s[i]);
-
Execution with pointer: int i=0; while((s+i)!='\0'){ printf("%c",(s+i)) ;
i++;
}
1 '\0' allowed command are executed until the 1st one: char s[]="Bayern Munchen"; s[3]='\0'; printf("%s",s); ---->Bay
strings
-
Input of strings: scanf func + %s char s[100]; scanf("%s",s); (No & bc s is an array pointer) Enter on keyboaerd Bayern Munchen printf("%s\n",s); ----> Bayern
Reading entire line up to closing enter char name[30];
printf("Enter name;");
fgets(name,sizeof(name),stdin);
printf("Name");
puts(name);
-
-