delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/21/06:49:57

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: - HELP! - a little mixed up in C/C++ pointers
Date: Mon, 18 Aug 1997 09:51:24 -0400
Organization: Cornell University
Lines: 47
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <33F8535C.4932@cornell.edu>
References: <33F7F642 DOT 30B9 AT usa DOT net>
NNTP-Posting-Host: 128
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gal wrote:
> 
> Okay here I start:
> 
> // defining types variables
> struct IndexFileName {
>   char FileName[12];
> }
> 
> int IndexFileName;
> 
> // our function
> int compare (char *FileName)
> {
>   return strcmp(Index.FileName, FileName);
> }
> 
> //main
> void main ()

FYI: int main(void)

> {
>   printf("%d\n", compare("TEST.TST"));

you did not include <stdio.h> for printf.

>   return 0;
> }

<NOT A FLAME: HONEST OPINION>
comp.os.msdos.djgpp is not a forum to discuss basic C/C++ issues. you
are better of posting to more relevant groups such as: comp.lang.c,
comp.lang.c++ and their moderated counterparts.
</END NOT A FLAME>

that said, do you not read what the compiler tells you:

C:\djgpp\c>gcc sss.c -o sss.exe
sss.c:5: two or more data types in declaration of `IndexFileName'
sss.c: In function `compare':
sss.c:10: `Index' undeclared (first use this function)
sss.c:10: (Each undeclared identifier is reported only once
sss.c:10: for each function it appears in.)

  -- Sinan

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019