Author |
Message |
Smart
Mudiripoyina Bewarse Username: Smart
Post Number: 3531 Registered: 03-2004 Posted From: 207.199.2.34
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 12:00 pm: | |
>>when I undefine an array like this can I populate the array again? you are not undefining anything here. When u define an integer or an array, most compilers initialize it with a value 0. So, we are making the contents of the array 0 by this method. array is still valid, and u can use it. To understand whats happening with this code, just print out the values of the array before and after this code. |
Aavakaaya
Pilla Bewarse Username: Aavakaaya
Post Number: 481 Registered: 04-2004 Posted From: 195.220.151.50
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:54 am: | |
thank you I will try this.. meanwhile.. when I undefine an array like this can I populate the array again? |
Smart
Mudiripoyina Bewarse Username: Smart
Post Number: 3530 Registered: 03-2004 Posted From: 207.199.2.34
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:47 am: | |
You can use either: memset(yourarray, 0, sizeof yourarray); or for( int i = 0 ; i < sizeof( yourarray ) / sizeof( yourarray[ 0 ] ) ; ++ i ) { yourarray[ i ] = 0 ; // or some other "clear" value } If it is a char array, just set the first element to '\0' |
Aavakaaya
Pilla Bewarse Username: Aavakaaya
Post Number: 480 Registered: 04-2004 Posted From: 195.220.151.50
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:39 am: | |
>>what type of array are u using? int |
Smart
Mudiripoyina Bewarse Username: Smart
Post Number: 3529 Registered: 03-2004 Posted From: 207.199.2.34
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:38 am: | |
what type of array are u using? char or int or ?? |
Aavakaaya
Pilla Bewarse Username: Aavakaaya
Post Number: 479 Registered: 04-2004 Posted From: 195.220.151.50
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:35 am: | |
I created the array dynamically through pointer decleration. I tried void free(void *ptr); but no use. any other suggestions. There is no undefine in C I guess. |
Michael_corleone
Pilla Bewarse Username: Michael_corleone
Post Number: 32 Registered: 05-2005 Posted From: 203.200.95.130
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:24 am: | |
Don COrleone septhe lang motham thirigi raayaalsine |
Kushi_ram
Celebrity Bewarse Username: Kushi_ram
Post Number: 9215 Registered: 04-2004 Posted From: 192.63.80.98
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:20 am: | |
kiki Manchi logic e kani C lo undefine operator unda.. KIKI |
Michael_corleone
Pilla Bewarse Username: Michael_corleone
Post Number: 26 Registered: 05-2005 Posted From: 203.200.95.130
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:14 am: | |
undefine array_name[no. of bytes to undefine ] |
Gaali
Pilla Bewarse Username: Gaali
Post Number: 3 Registered: 05-2005 Posted From: 149.166.137.217
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:04 am: | |
kill bill |
Kushi_ram
Celebrity Bewarse Username: Kushi_ram
Post Number: 9213 Registered: 04-2004 Posted From: 192.63.80.98
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:02 am: | |
dynamic memory allocation vadu mama... |
Gaali
Pilla Bewarse Username: Gaali
Post Number: 2 Registered: 05-2005 Posted From: 149.166.137.217
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 11:01 am: | |
Good question answer will follow now |
Aavakaaya
Pilla Bewarse Username: Aavakaaya
Post Number: 478 Registered: 04-2004 Posted From: 195.220.151.50
Rating:N/A Votes: 0(Vote!) | Posted on Friday, May 06, 2005 - 10:35 am: | |
am doing some very basic prog in C... is there a way to undefine an array. am reading from a file and populating an array...at the end of reading each line I'll check some condition..if it fails I want to clear the array. How can I do this. |