Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
string_ptr_to_fct_param_v2
//gcc 5.4.0 #include <stdio.h> int c; typedef struct { int a; char str[100]; char str2[100]; int b; }str_samp; str_samp sample, *sptr, *ssptr; int func(int *a, char *rstr, char *pstr) { *a=6; strcpy(rstr,"Hello"); strcpy(pstr,rstr); //*(rstr+5)='!'; strcat(rstr," Good luck."); *(rstr+15)='!'; memmove(pstr+5,rstr+10,5); *(pstr+10)='!'; return(*a); } int main(void) { sample.a=50; sample.b=100; memset(sample.str2,99,0); memset(sample.str,99,'0'); sptr = &sample; ssptr = &sample; c=func(&sptr->a,sptr->str,ssptr->str2); printf("a=%d, b=%d, c=%d, str:%s, str2:%s", sample.a, sample.b, c, sample.str, sample.str2); return 0; }
run
|
edit
|
history
|
help
0
PJE
Test2
MatrixMul_shortxshort
fork() System call
Max2
Lab 11
pattern 17
2.2 Comparision with Matrix Addition Execution Time
FUNTION4
Goodone pointer minus void pointer