Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,287 members, 7,811,862 topics. Date: Sunday, 28 April 2024 at 09:37 PM

How To Allocate Space For Ragged Array Using Calloc() Or Malloc? HELP! - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How To Allocate Space For Ragged Array Using Calloc() Or Malloc? HELP! (971 Views)

Write An Algorithm To Shuffle An Array / When Do I Use Calloc() And Malloc() In C Language? / Java Array Problem (2) (3) (4)

(1) (Reply) (Go Down)

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:
Have you included stdlib library.

yes.
Re: How To Allocate Space For Ragged Array Using Calloc() Or Malloc? HELP! by Nobody: 1:45pm On Dec 03, 2019
BlaqTesla:


yes.
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:

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.

I have solved the problem already. Thanks

(1) (Reply)

2021 Magico Box / Software Developer Required To Build Application Prototype / .....

(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. 8
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.