005 - 5 5.1 : type-specifier var_name [size]; C : sizeof(...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
5 5.1 : type-specifier var_name [size]; C : s i z e o f ( ) * [ 5-1] 0 9 main( ) { int x[10]; /* 1 0 x [ 0 ] x [ 1 ] . . . x [ 9 ] * / int t ; for (t=0; t<10;++t) x[t]=t; } C gets( ) a : char a[7] 5 - 1 a 1 0 0 0 5-1 1000 5.1.1 C i func1( ) main( ) 1 0 0 0 1 0 0 1 1 0 0 2 1 0 0 3 1 0 0 4 1 0 0 5 1 0 0 6
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
{ int i[10]; func1(i); /* * / . . . } 1) 2) func1 ( ) i : f u n c 1 ( s t r ) char str[10]; /* * / { . . . } : f u n c 1 ( s t r ) char str[ ]; / * * / { . . . } C func1 (str); int str[32]; { . . . } func1( ) 3 2 5.1.2 C \ 0 1 0 s : char s[11]; 5 7 9
Background image of page 2
C : "hello there" "this is a test" C C : strcpy(s1 s2) s 2 s 1 strcat(s1 s2) s 2 s 1 s t r l e n ( s 1 ) s 1 s t r c m p ( s 1 s 2 ) s 1 s 2 s 1 < s 2 s 1 > s 2 5 - 2 [ 5 - 2 ] # include <stdio.h> main ( ) { char s1[80] s2[80]; /* * / gets (s1); /* * / gets (s2); printf ("lengthsf: %d %d \n"s t r l e n ( s 1 ) s t r l e n ( s 2 ) ) ; if (!strcmp(s1 s2)) printf ("the strings are equal \n"); s t r c a t ( s 1 s 2 ) ; printf ("%s\n" s 1 ) ; } strcmp( ) Fa l s e h e l l o h e l l o : R U N h e l l o h e l l o lengths:5 5 The strings are equal h e l l o h e l l o 5.2 5.2.1 C 8 0 C
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
d 1 0 2 0 : int d[10][20] C 0 d 3 5 : d [ 3 ] [ 5 ] 5 - 3 1 2 [ 5 - 3 ] main ( ) { int t i n u m [ 3 ] [ 4 ] for (t=0; t<3; ++t) for (i=0;i<4;++i) n u m [ t ] [ i ] = ( t * 4 ) + i + 1 ; } n u m [ 0 ] [ 0 ] 1 n u m [ 0 ] [ 2 ] . . . . . . n u m [ 2 ] [ 3 ] 1 2 0 1 2 3 0 1 2 3 4 1 5 6 7 8 2 9 1 0 11 1 2 5 - 2 1 0 5 1 0 5 2=100 [ 0 ] [ 0 ] C 1 0 1 0 func1 (x) int x[ ][10] { . . . } 5 8 1
Background image of page 4
0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 3 0 3 1 3 2 3 3 3 4 3 5 3 6 3 7 4 0 4 1 4 2 4 3 4 4 4 5 4 6 4 7 5 0 5 1 5 2 5 3 5 4 5 5 5 6 5 7 6 0 6 1 6 2 6 3 6 4 6 5 6 6 6 7 5-2 C X [ 2 ] [ 4 ] [ 5-4] #define classes 3 #define grades 30 #include <stdio.h>
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

005 - 5 5.1 : type-specifier var_name [size]; C : sizeof(...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online