A4 - strings

char name[] = "string";
escape sequence meaning
\n new line
\t horizontal tab
\' single quote
\" double quote
\x43 ASCII hex (for 'C')
\0 null
\\ backslash
char name[40]; /* an array that can contain 39 characters */
scanf("%39s", name); /* note that there is no '&' */
printf("hello, %s!\n", name);
#include <string.,h>

char dest[100];

strcpy(dest, source); /* dest = source */
strcat(dest, source); /* dest + source */

/* safer string functions  that explicity state the maximum size*/

strcpy_s(dest, sizeof(dest), source); /* dest = source */
strcat_s(dest, sizeof(dest), source); /* dest + source */

puts(dest); /* prints out the string with a new line */

char msg[40];
strcat_s(msg, sizeof(msg), "'"hello")
int size = sizeof(msg) /* 40 */
int length = strlen(msg) /* 6 */


strcmp(password, "password" /* comparison: 0 if equal */