Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int n = 4;
- int *p = &n;
- ///////////////////////////////////////////////////
- int main() //
- {
- printf("*p = %d\n", *p);
- printf(" p = %d\n", p);
- }
- /*
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- ///////////////////////////////////////////////////
- void foo(int *p)
- {
- for(int i = 0; i < 20; i++)
- {
- printf("nArr[%2d] = %4d \n", i, p[i]);
- }
- }
- ///////////////////////////////////////////////////
- int main() //
- {
- int nArr[20] = {0, 0, 1000, 41};
- foo(&nArr[0]);
- }
- */
- /*
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int nArr[20],
- max = 0 ,
- min = 0 ;
- ///////////////////////////////////////////////////
- int main() //
- {
- srand(time(0));
- for(int i = 0; i < 20; i++)
- {
- nArr[i] = (rand()%100) - 50;
- printf ("nArr[%2d] = %3d \n", i, nArr[i] );
- if(nArr[i] > max) max = nArr[i];
- if(nArr[i] < min) min = nArr[i];
- }
- printf(" max = %3d\n", max);
- printf(" min = %3d\n", min);
- }
- */
- /*
- #include <stdio.h>
- float f1 = 5,
- f2;
- ///////////////////////////////////////////////////
- int main() //
- {
- f2 = f1 / 2;
- printf ("f2 = %.1f \n", f2);
- }
- */
- /*
- #include <stdio.h>
- int n1 = 5,
- n2;
- ///////////////////////////////////////////////////
- int main() //
- {
- n2 = n1 / 2;
- printf ("n2 = %d \n", n2);
- }
- */
- /*
- #include <stdio.h>
- ///////////////////////////////////////////////////
- int main() //
- {
- int nArr[20],
- max = 0 ,
- min = 0 ;
- for(int i = 0; i < 20; i++)
- if(nArr[i]>max|| nArr[i]<min)
- {
- printf ("nArr[%2d]= %d \n" ,i ,max);
- }
- {
- // printf("nArr[%2d] = %d \n", i, nArr[i]);
- }
- }
- */
- /*
- #include <stdio.h>
- ///////////////////////////////////////////////////
- int main() //
- {
- int nArr[20],
- max = 0 ,
- min = nArr[0] ;
- for(int i = 0; i < 20; i++)
- {
- if(nArr[i] < min) min = nArr[i];
- printf("nArr[%2d] = %d \n", i, nArr[i]);
- }
- printf(" min = %d\n", min);
- }
- */
- /*
- #include <stdio.h>
- ///////////////////////////////////////////////////
- int main() //
- {
- int n = 4 ;
- int *p = &n ;
- printf(" n = %d \n", n);
- printf(" p = %d \n", p);
- printf("*p = %d \n", *p);
- printf("&p = %d \n", &p);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement