plan_B: C/C++: free -> Fehler

Beitrag lesen

moin, moin

  

>        char b=0;  
>        char *a;  
>        a=(char*) malloc(b);  
>        free(anfang);//<-  passierts: run-time check failure #2 stack around the variable 'b' was corrupted  

sollte b nicht besser vom Typ int oder unsigned int sein und b>0 ?

Gruß plan_B

--
     *®*´¯`·.¸¸.·