using codeblocks
-----------------------------------------------------------------------------------------------------
//program to find reverse of string using pointer passed to function// program title
#include <stdio.h> //header file
#include <string.h> // header file to handle string
void string_length(char []); // function prototype with character array
int main()
{
char string[50]; // character string
puts("enter string\n");
gets(string); //gets string
string_length(string); //calling of function with string as parameter
// here, string is passed as reference to formal parameter
return 0;
}
void string_length(char *strings)// this accepts string with address
{
strrev(strings); // supplies length
puts(strings); //displays string
}
//note: we can also use char string[] with void string_length in body line. It works.
//once you try.It runs.
//but we can not pass string as pointer in prototype.
// i.e. void string_length(char *[]);
-----------------------------------------------------------------------------------------------------
//program to find reverse of string using pointer passed to function// program title
#include <stdio.h> //header file
#include <string.h> // header file to handle string
void string_length(char []); // function prototype with character array
int main()
{
char string[50]; // character string
puts("enter string\n");
gets(string); //gets string
string_length(string); //calling of function with string as parameter
// here, string is passed as reference to formal parameter
return 0;
}
void string_length(char *strings)// this accepts string with address
{
strrev(strings); // supplies length
puts(strings); //displays string
}
//note: we can also use char string[] with void string_length in body line. It works.
//once you try.It runs.
//but we can not pass string as pointer in prototype.
// i.e. void string_length(char *[]);
---------------------------------------------------------------------------------------
using turboC++
------------------------------------------------------------------------------------------------
//program to find reverse of string using pointer passed to function// program title
#include <stdio.h> //header file
#include <string.h> // header file to handle string
#include<conio.h>
void string_length(char []); // function prototype with character array
int main()
{
char string[50]; // character string
puts("enter string\n");
gets(string); //gets string
string_length(string); //calling of function with string as parameter
// here, string is passed as reference to formal parameter
getch();
return 0;
}
void string_length(char *strings)// this accepts string with address
{
strrev(strings); // supplies length
puts(strings); //displays string
}
//note: we can also use char string[] with void string_length in body line. It works.
//once you try.It runs.
//but we can not pass string as pointer in prototype.
// i.e. void string_length(char *[]);