473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Error of : initialization makes pointer from integer without a cast

6
Hi there, im pretty new to this forum and would be grateful of some help. I've only started programming this year and am pretty lazy with it so please bare with me if im acting like a bit of a noob...

right basically im trying to define a struct that will hold names for a phonebook i.e. with a string and a number

i have #included<stdlib.h> and everything else I need, and the 2 parts im struggling with are as follows

typedef struct {char name[20]; int num;} Phnbk;

Phnbk makeBook(char name[20], int num){
Phnbk entry = {name, num};
return entry;
}

from what I can see everything is in order, but when I compile I get an error saying:
In function makeBook:
warning: initialization makes pointer from integer without a cast

the rest of the code is fine in the program and compiles and runs perfectly when the above lines are commented out...

Any suggestions?

Cheers, Dan
Sep 1 '07 #1
1 11635
dn6326
6
Hi all, sorted it, I did try making the name a pointer i.e. entry = {*name.. but i clearly didnt save before re compiling and trying all sorts of other rubbish...such a noob...oh well thanks anyways!
Sep 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dawn Minnis | last post by:
Hi When I compile my files I get the following: driver.c: In function `main': driver.c:49: warning: assignment makes integer from pointer without a cast driver.c:50: warning: assignment...
3
by: Levi Campbell | last post by:
Hi, I'm trying to debug an app someone else wrote called eMixer. Here's the log contents: cc -O3 -funroll-loops -c -o main.o main.c cc -O3 -funroll-loops -c -o nctgui.o nctgui.c cc -O3...
33
by: Martin Jørgensen | last post by:
Hi, In continuation of the thread I made "perhaps a stack problem? Long calculations - strange error?", I think I now got a "stable" error, meaning that the error always seem to come here now...
17
by: prakashraovaddina | last post by:
Hi ppl, can some one say if the following pointer initialization is legal or no. int *intPtr = 5; While debugging i still see that the pointer is given some address. However, the...
6
by: Kinbote | last post by:
Hi, I'm trying to make a function that opens a file, reads it in line by line, puts each line into an malloc'd array, and returns the array. I suspect I'm going about it in an atypical fashion, as...
3
by: horacius.rex | last post by:
Hi, trying to compile the following program I obtain the error. myran.c: In function 'main': myran.c:66: warning: passing argument 1 of 'ran0' makes pointer from integer without a cast Do...
1
by: woods1313drew | last post by:
The following code in c+ gives me the warning assignment makes integer from pointer without a cast. destination is set as char destination to limit the input string to 10 characters. name is an...
1
by: Gavin Chen | last post by:
Hello, I tried to install Tk400.200 on SunOS 4.1.4. At "make" time, I got the error message as below: cd pTk; make -e syntax OK -e syntax OK -e syntax OK -e syntax OK -e syntax OK -e...
1
by: anu29dolly | last post by:
error:return makes integer from pointer without a cast.. following is my code ..plz help to track the bug ......... #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.