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

  • Home
  • SEARCH
  • 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 6792459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:58:19+00:00 2026-05-26T17:58:19+00:00

#include <stdio.h> #include <ctype.h> #define STRING_LEN 500 void stripspaces(char, char, char); int main(void) {

  • 0
#include <stdio.h>  
#include <ctype.h>  
#define STRING_LEN 500         
void stripspaces(char, char, char);


int main(void)  
{  
   char string[STRING_LEN];         
   char *p1 = string;          
   char *p2 = string;

   printf("Enter a string of up to %d characters:\n", STRING_LEN);  
   while((*p1++ = getchar()) != '\n') ; 

  stripspaces(string, *p1, *p2); 

  getch();  
  return 0;
}  
void stripspaces (char s, char *x1, char *x2){ 
   *x1 = '\0';                 
   x1 = s;                
   while(*x1 != '\0')    
   {  
     if(ispunct(*x1) || isspace(*x1))  
     {                    
       ++x1;              
       continue;  
     }  
     else  
       *x2++ = *x1++;   
   }  
   *x2 = '\0';          
   printf("\nWith the spaces removed, the string is now:\n%s\n", s);  
}

This code is bringing up the following error at the ‘stripspaces‘ function; “passing arg 1 of ‘stripspaces‘ makes integer from pointer without a cast” any help would be excellent.

In case it is not obvious from the code, the program should take in a string and remove all the spaces from it. The function has to remain although I know I can do it without the function.

  • 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-26T17:58:20+00:00Added an answer on May 26, 2026 at 5:58 pm

    Your prototype and function definition don’t match:

    void stripspaces(char, char, char);
    

    vs.

    void stripspaces (char s, char *x1, char *x2)
    

    You should change the prototype to

    void stripspaces(char, char*, char*);
    

    And in order to make them both work, you should use

    void stripspaces(char*, char*, char*);
    

    and

    void stripspaces (char *s, char *x1, char *x2)
    

    .

    For easier copy & paste, you can use parameter names in the prototype as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <stdio.h> #include <string.h> #include <ctype.h> void delspace(char *str); int main() { int i,
#include <stdio.h> #include <ctype.h> /*header for standard tolower function*/ #define STRING_LEN 500 char *
#include<stdio.h> #include<ctype.h> #include<string.h> int main() { int i=0,j,k,lines_count[2]={1,1},operand_count[2]={0},operator_count[2]={0},uoperator_count[2]={0},control_count[2]={0,0},cl[13]={0},variable_dec[2]={0,0},l,p[2]={0},ct,variable_used[2]={0,0},constant_count[2],s[2]={0},t[2]={0}; char a,b[100],c[100]; char d[100]={0}; j=30; FILE
Code : #include stdio.h #include string.h int main() { char *p = abc; printf(p
My code #include <stdio.h> #include <stdlib.h> #include <ctype.h> void getData(short int *number, char *string)
#include<stdio.h> #include<string.h> #include<stdlib.h> int main() { // int char str[40],ch; FILE*fp,*fp1,*fp2; fp=fopen(ide_input,w); fp1=fopen(error_log,w); fp2=fopen(lex_output,w);
#include<stdio.h> #include<ctype.h> int main() { char a,b; FILE *fp; fp=fopen(lext.txt,w); fprintf(fp,PLUS); return 0; }
Consider the following code: #include <stdio.h> #include <ctype.h> char* Mstrupr(char* szCad); int main() {
#include <stdio.h> int main() { float a = 1234.5f; printf(%d\n, a); return 0; }
#include<stdio.h> int main() { printf(He %c llo,65); } Output: He A llo #include<stdio.h> int

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.