Hey, I am having a problem with my program, it keeps saying that
95 [Warning] passing arg 1 of `initmovie' makes pointer from integer without a cast
95 [Warning] passing arg 2 of `initmovie' makes pointer from integer without a cast
Below is my program...Any help with be greatly appreciated..thanks in advance.
The Error is pointed out in red below:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
struct movie {
char * title; //movie title
char * director; //director's name
int year; //release year
int duration; //expressed in minutes
struct movie *next; //pointer to next movie
};
typedef struct movie MovieRecord;
typedef struct movie *MovieRecordPtr;
void NewMovie(void);
struct movie *initmovie( char *, char *, int, int );
void insertmovie( struct movie * );
void printlist( struct movie * );
//struct movie *strPtr = (struct movie *) NULL;
//struct movie *endPtr = (struct movie *) NULL;
MovieRecordPtr strPtr = NULL;
MovieRecordPtr endPtr = NULL;
int main(int argc, char *argv[])
{
char title;
char director;
int year;
int duration;
struct movie *ptr;
NewMovie();
printlist(strPtr);
system("PAUSE");
return 0;
}
void NewMovie(void)
{
char title;
char director;
int year;
int duration;
struct movie *ptr;
int count = 0;
int amount = 0;
printf("\nHow many movies do you want to store? ");
scanf("%d", &amount);
while(amount != 0)
{
count++;
printf("\nMovie #%d ", count);
printf("\t Title: \t\t");
scanf("%s", &title);
char c =getchar();
printf("\n");
printf("\t\t Director: \t\t");
scanf("%s", &director);
char d =getchar();
printf("\n");
printf("\t\t Duration of minutes: \t");
scanf("%d", &duration);
printf("\n");
printf("\t\t Year: \t\t\t");
scanf("%d", &year);
ptr = initmovie( title, director, duration, year );
insertmovie( ptr );
}
}
struct movie *initmovie( char *title, char *director, int duration, int year )
{
struct movie *ptr;
ptr = (struct movie *) calloc( 1, sizeof(struct movie ) );
if( ptr == NULL )
return (struct movie *) NULL;
else {
strcpy( ptr->title, title );
ptr->director = director;
return ptr;
}
}
*/
void insertmovie( struct movie *new )
{
struct movie *temp, *prev;
if( strPtr == NULL ) {
strPtr = new;
endPtr = new;
strPtr->next = NULL;
return;
}
temp = strPtr;
while( strcmp( temp->title, new->title) < 0 ) {
temp = temp->next;
if( temp == NULL )
break;
}
if( temp == strPtr ) {
new->next = strPtr;
strPtr = new;
}
else {
prev = strPtr;
while( prev->next != temp ) {
prev = prev->next;
}
prev->next = new;
new->next = temp;
if( endPtr == prev )
endPtr = new;
}
}
void printlist( struct movie *ptr )
{
while( ptr != NULL )
{
printmovie( ptr );
ptr = ptr->next;
}
}



LinkBack URL
About LinkBacks




I used to be an adventurer like you... then I took an arrow to the knee.