/* COMP 2401/2001 - W13 String literals are constant strings stored in the data segment of the virtual memory. You can read the individual chars like an array. You cannot change any element of a string literal mjh - 2013 */ #include // where might you need a string literal? // how about this function? char digitToHex(int decimal){ // reduce input modulo 16 so the only return a single hex digit return "0123456789ABCDEF"[decimalDigit % 16]; } // how about common input/output? // These might be used throughout your code char *warning1 = "Warning : input size too big"; char *warning2 = "Warning : input size too small"; int main(){ printf("element of a string literal : %c\n", "12345"[1]); char a[] = "red fish"; char* b = "blue fish"; a[1] = 'Q'; // b[1] = 'X'; // ERROR! printf("string a=%s\n", a); printf("string b=%s\n", b); }