Memory allocation

Posted on 1998-09-21
Last Modified: 2012-05-07
   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"
Question by:manjucee
  • 3
  • 3
LVL 10

Accepted Solution

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);

Author Comment

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

Author Comment

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.
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

LVL 10

Expert Comment

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

Expert Comment

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

Author Comment

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
It is giving "Type name expected" for all i.e., move, menu(),ibm.obj

Featured Post

New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to set environment variables in C 2 78
How to issue a linefeed, pause, and clear screen in UNIX enviroment 3 69
how to understand recursion 12 218
valid enum? 6 73
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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 recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

920 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

14 Experts available now in Live!

Get 1:1 Help Now