Add some code about strings

This commit is contained in:
pro100ton 2025-01-23 22:00:48 +03:00
parent 58aa6aba6c
commit 8bb4bc8a64

View file

@ -0,0 +1,15 @@
#include <stdio.h>
int main(void) {
// String literal assigment
char *p;
/*Following statement does not copy string. It makes pointer p to point to first charachter of list of chars*/
p = "abc";
printf("%s\n\n", p);
// ---
// Subscripting
char ch;
ch = p[1];
printf("%c\n", ch);
}