Thread: Error while trying to initialize pointer to a struct!

  1. #1
    Registered User
    Join Date
    Aug 2010

    Arrow Error while trying to initialize pointer to a struct!

    I wrote a program about structs and pointers...but i think i have one mistake! Please take a look at the code:

    I suppose my serious problem is only at the red mark and more specific when initializing the pointer! I hope so...

    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    struct Packet{
    	int id;
    	char content[5];
    int intit_Max(struct Packet A[], int size){
    	int i, j, maxS;
    	struct Packet max5;
    		for(i=0; i<size; i++){
    			for(j=0; j<4; j++){
    				printf("%12d%s\n", A[i].id, A[i].content);
    				for(i=0; i<size; i++){
    					if( A[i].id > maxS ){
    							return maxS;
    int main(void){
    	struct Packet A[10];
    	struct Packet *myS;
    		myS = init_Max(A, 10);
    		printf("\nMax: %d%f\n",, myS.content);
    Thank you in advance...

  2. #2
    Registered User
    Join Date
    May 2010
    init_Max return int. and you assigned to ..?!

  3. #3
    Join Date
    Oct 2007
    Inside my computer
    Also tried to use "." on a pointer...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help assignment due tomorrow
    By wildiv in forum C Programming
    Replies: 6
    Last Post: 01-27-2010, 08:38 PM
  2. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-21-2009, 12:37 AM
  3. pointer problem or so...
    By TL62 in forum C Programming
    Replies: 19
    Last Post: 01-12-2008, 11:45 PM
  4. Global Variables
    By Taka in forum C Programming
    Replies: 34
    Last Post: 11-02-2007, 03:25 AM
  5. Bi-Directional Linked Lists
    By Thantos in forum C Programming
    Replies: 6
    Last Post: 12-11-2003, 10:24 AM