As MK27 said the Struct is not properly defined, missing curly braket at the end
The main function is think is not now defined correctly can you confirm this MK27?
Type: Posts; User: Tom Bombadil
As MK27 said the Struct is not properly defined, missing curly braket at the end
The main function is think is not now defined correctly can you confirm this MK27?
I am just a beginner at C so perhaps this is irrelevant.
int x =6;
int *p=&x
should you not initialise the pointer like this:
matsp, thanks for taking the time to respond. I will have to digest what you have said and try to fix things later. I should get back to my work, unfortunately!
You want me to post the code again?
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
Everything works now. I have learnt my lesson the declare the function prototypes AFTER the structure if they are calling them...
When I run the program I get this:
...
I am blind!
sorry matsp, i completely missed that and thanks also MK27 and Brafil
a quick update with the errors I am having problem solving:
qa@qa:~/Programming$ gcc -o struct_callsFUNC struct_callsFUNC.c
struct_callsFUNC.c:7: warning: \u2018struct CALL\u2019 declared inside...
also I get an error here, when trying to write to the file:
if (nf != NULL) {
fwrite(&c, 1, sizeof(CALL), nf);
fclose(nf);
}
struct_callsFUNC.c: In function \u2018main\u2019:
struct_callsFUNC.c:56: warning: passing argument 1 of \u2018createFile\u2019 makes integer from pointer without a cast
struct_callsFUNC.c:56:...
You mean in my function prototype and function have : struct CALL c instead of struct call:
void createFile(char filename, struct CALL c);
is the function call :
Hello folks,
I hope my question is not wasting anyones time here. I was trying to make a program that will assist me in my daily work, the idea being to automatically generate a file that...
solved it!
Hello,
I have a question in regards to how do I make a function return value go to a specific record of a structure.
I have tried a few ways to do this but can't seem to see how to do it. ...
Understood,
thanks, much appreciate matsp.
So this is the correct way?:
char *stringp = "String";
char *stringp2;
char ch[7];
stringp2 = &ch;
It compiles but gives me a segmentation fault.
tabstop why can I not define it as:
char *stringp2;
For an empty string or something...
I am practicing with pointers presently, trying to get my knowledge on the matter more robust.
I created one program that just uses 2 points and another that uses on string and one array.
Both...
Thanks everyone, got it working now. Didn't see all the other replies posted before my last post!
Much appreciated :D
And i will try to indent my C code better too. Enjoy the rest of...
Thanks matsp:
char *genCallNr(){
char callnr = malloc(12);
time_t now;
struct tm *ts;
char buf[12];
//char callnr[11];
Thank you MK27
I corrected the things that you pointed out. However things don't run smoothly.
I managed to get the code from the VMware:
#include<stdio.h>
#include<stdlib.h>...
I am a beginner to C programming. I have done a few programs here and there and am also following the book 'The C programming language' by K&R.
The program consists of 2 parts: the main and 1...
Also got it working for arrays. Great.
Thanks again!
Thanks you vart, much appreciated. It worked with a single object, will try with an array of structures now.
Hello,
sorry if this seems like a trivial query but I was having some issue setting a string to a char array in a structure. I have a set up like this:
typedef struct
{
int date; char...