Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6252571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:49:46+00:00 2026-05-24T13:49:46+00:00

I am getting errors for the below program. #include stdafx.h #include<stdio.h> struct s {

  • 0

I am getting errors for the below program.

#include "stdafx.h"
#include<stdio.h>

struct s 
{
  char *st;
  struct s *sp; 
};

struct s *p1,*p2;
swap(p1,p2);

int main()
{
    int i;
    struct s *p[3];
    static struct s a[]={
        {"abc",a+1},{"def",a+2},{"ghi",a}
    };
    for(i=0;i<3;i++)
    {
     p[i]=a[i].sp;
    }
    swap(*p,a);
    printf("%s %s %s\n",p[0]->st,(*p)->st,(*p)->sp->st);
    return 0;
}

swap(p1,p2)
{
    char *temp;
    temp = p1->st;
    p1->st = p2->st;
    p2->st = temp;
}

How to make this program working.Even if we didnt put int before swap I hope it will by default take it as int .

error C4430: missing type specifier – int assumed. Note: C++ does not
support default-int

error C2078: too many initializers

error C2440: ‘initializing’ : cannot convert from ‘s *’ to ‘int’
There is no context in which this conversion is possible

error C2450: term does not evaluate to a function taking 2 arguments

error C2456:’swap’ : function-style

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:49:46+00:00Added an answer on May 24, 2026 at 1:49 pm

    Try

    void swap(struct s *p1, struct s *p2);
    
    void swap(struct s *p1, struct s *p2)
    {
        char *temp;
        temp = p1->st;
        p1->st = p2->st;
        p2->st = temp;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include stdafx.h #include <windows.h> #include <winsock.h> #include <stdio.h> int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR IpCmdLine,int
So my code is below. I'm not getting any errors and it places everything
I was changing the vc++ include directory with new paths suddenly getting below error
Please take a look at the program below. Why am I getting an error?
I am executing a program in PHP and getting the below error sometimes.Is this
I am getting an error for the below program on the data_derived.m data_derived.m @implementation
I am getting errors for the below code. @interface event : NSObject { NSMutableDictionary
I really need help with the java program...i am getting errors when i am
I'm getting the following error on the line of code below: Syntax error (missing
I'm trying to do a simple erase and keep getting errors. Here is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.