Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Test 4
//gcc 5.4.0 #include <stdio.h> #include <string.h> char *p; int *addr; unsigned int array1[]={11,22,33,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,0}; char array[]="Hello you guys", x='l'; int i; typedef struct { int a; char b; char array[4]; int dec_array[2]; char terminate; }str; str struct1, *strptr; int main(void) { *(int*)0x601080=127; p=array; for ( i = 0; i < 5; i++ ) { printf("*(p + %d) : %c\n", i, *(p + i) ); } addr=array1; for ( i = 0; i < 5; i++ ) { printf("\n*(addr + %u) : %p, Value:%u\n", i, addr, *addr); addr++; } printf("\n sizeof(int) is:%d,bytes \n uInt(MAX) is:%u", sizeof(int),0xFFFFFFFF); i=5; printf("\n Priority is:%d\n", (++i+2)); //----------------------------- Srtr ------------------------------------------------ strptr=&struct1; strptr->a=1198; strptr->b=20; memset(strptr->array, '\0', sizeof(strptr->array)); memset(strptr->dec_array, '\0', sizeof(strptr->dec_array)); strptr->dec_array[2]=1600; strptr->terminate=0; i=0; while(array[i]) { printf("\n Array address %d (%p), Value:%c", i, &array[i], array[i]); i++; } p=0x601072; i=0; while(i<40) { printf("\n\n Address (%p), Value:%u, ASCII:%c", p, *p, *p); i++; p++; } i=0; printf("\n\n Array address %d (%p), Value:%c", i, &array[i], array[i]); printf("\n Array address %d (%p), Value:%c", (i+sizeof(array)), &array[sizeof(array)], array[sizeof(array)]); printf("\n\n Array size %d\n", sizeof(array)); i=0; printf("\n Int i address %d (%p), Value:%d", i, &i, i); printf("\n Str address %d (%p), Value:%d", i++, &strptr->a, strptr->a); printf("\n Str address %d (%p), Value:%d", i++, &strptr->b, strptr->b); printf("\n Str address %d (%p), Value:%s", i++, &strptr->array, strptr->array[0]); printf("\n Int address0 %d (%p), Value:%d", i++, &strptr->dec_array, strptr->dec_array[0]); printf("\n Int address1 %d (%p), Value:%d", i++, &strptr->dec_array[1], strptr->dec_array[1]); printf("\n Int address2 %d (%p), Value:%d", i++, &strptr->dec_array[2], strptr->dec_array[2]); printf("\n Str address %d (%p), Value:%d", i++, &strptr->terminate, strptr->terminate); return 0; }
run
|
edit
|
history
|
help
0
Pointer Example
MEMORIA DINAMICA FUNCIONA
armstrong number using a while loop
MATRICES DE CARACTERES
vetor mult
Pregunta 3 de registros
18BCE2182 ASSESS_2 Q4
static int account
Project 3 part 2 Book v10.1
extra causes class UK assisment