Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,192,959 members, 7,949,275 topics. Date: Sunday, 15 September 2024 at 02:47 AM |
Nairaland Forum / Science/Technology / Programming / How To Allocate Space For Ragged Array Using Calloc() Or Malloc? HELP! (1074 Views)
Write An Algorithm To Shuffle An Array / When Do I Use Calloc() And Malloc() In C Language? / Java Array Problem (2) (3) (4)
How To Allocate Space For Ragged Array Using Calloc() Or Malloc? HELP! by Nobody: 1:10pm On Dec 03, 2019 |
Please i have been trying to allocate a memory space for a ragged array (arrays of pointers of type char). but it happens that the two functions are not working. I used the assert function to know if the calloc() worked and it worked. My program do compile but when i enter a long string the program either terminates or jump to another memory location of the row index.
|
Re: How To Allocate Space For Ragged Array Using Calloc() Or Malloc? HELP! by Nobody: 1:19pm On Dec 03, 2019 |
Have you included stdlib library. |
Re: How To Allocate Space For Ragged Array Using Calloc() Or Malloc? HELP! by Nobody: 1:27pm On Dec 03, 2019 |
Ausrichie: yes. |
Re: How To Allocate Space For Ragged Array Using Calloc() Or Malloc? HELP! by Nobody: 1:45pm On Dec 03, 2019 |
BlaqTesla:Ahn what error did you get. And secondly check stdlib header if the function prototype was declared there had a problem with gets() sometime ago realised that gets() was obsolete. |
Re: How To Allocate Space For Ragged Array Using Calloc() Or Malloc? HELP! by Nobody: 2:00pm On Dec 03, 2019 |
Ausrichie: I have solved the problem already. Thanks |
(1) (Reply)
Creating My First Video Game / A Book Referencing App I Created / My Take On CHATGPT On The Web Development World From The Aspect Of A Junior Dev
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 6 |