Solved

Memory allocation

Posted on 1998-09-21
6
202 Views
Last Modified: 2012-05-07
Hi,
   1)Whenever I used to allocate memory by declaring char *
and using faralloc , or malloc , etc , I will get a error
"Can't convert void * to char *" because as you know it is declared as void * malloc or faralloc in alloc.h.
  2) Please tell me how to develop a project in c (step by step). Because I tried to develop but when I used to build .prj file it give "Type name expected"
0
Comment
Question by:manjucee
  • 3
  • 3
6 Comments
 
LVL 10

Accepted Solution

by:
rbr earned 50 total points
ID: 1252948
You have to use a casting after malloc statement since malloc returns a void pointer

char *ptr;

prt=(char *)malloc (size);
0
 

Author Comment

by:manjucee
ID: 1252949
Hi rbr,
                   Thanks for giving me a solution , I dont know how i forgot this simple logic.
0
 

Author Comment

by:manjucee
ID: 1252950
Hi rbr,
           What about the second question that i have asked on creating a project in c.
Really I dont know how to do that one. I am facing lot of error message please guide me.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Expert Comment

by:rbr
ID: 1252951
Which compiler and OS to you use?
0
 
LVL 10

Expert Comment

by:rbr
ID: 1252952
What have you done already in your project and which errors do you get?
0
 

Author Comment

by:manjucee
ID: 1252953
Hi rbr,
                  It's Turbo C++ and OS is Windows NT 4.0
Here is the listing of .prj file
move  // driver program
menu(menu.h,keys.h)
ibm.obj
It is giving "Type name expected" for all i.e., move, menu(),ibm.obj
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now