Inbuilt functions in cpp, C/C++ Programming

Inbuilt Functions

i).  Functions to manipulate strings

The cstring library defines many functions to perform some manipulation operations with C-styled functions. The following are some of these functions:

  • strcat: char* strcat (char* dest, const char* src); Appends src string at the end of dest string.
    Returns dest.
  • strcmp: int strcmp (const char* string1, const char* string2); Compares strings string1 and
    string2. Returns 0 is both strings are equal.
  • strcpy: char* strcpy (char* dest, const char* src); Copies the content of src to dest. Returns dest.
  • strlen: size_t strlen (const char* string); Returns the length of string.

ii). Converting strings to other types

Due to that a string may contain representations of other data types like numbers it might be useful to translate that content to a variable of a numeric type. The cstdlib library provides three useful functions for this purpose:

  • atoi: converts string to int type.
  • atol: converts string to long type.
  • atof: converts string to float type.

All of these functions accept one parameter and return a value of the requested type (int, long or float).  

Posted Date: 8/21/2012 11:53:26 AM | Location : United States







Related Discussions:- Inbuilt functions in cpp, Assignment Help, Ask Question on Inbuilt functions in cpp, Get Answer, Expert's Help, Inbuilt functions in cpp Discussions

Write discussion on Inbuilt functions in cpp
Your posts are moderated
Related Questions
Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Operators The variables, which are declared and explained, are the operands, which are operated upon by the operators. Operators specify what operations are to be performed on

The probabilistic Hough transform uses random sampling instead of an accumulator array. In this approach the number of random samples r, is not specified in the OpenCV call, but is

program to convert string from super ascii string with minimum cost

HOW CAN WE EASLY LEARN C++

flowcharting of 3 quizes display the average

Write a C program "team.c" that maintains information for a soccer team. The program will allow you to add and delete players from your team, to search your team for players by nam

C program to demonstrate Pointer to variable: void p2a(int *); void main() {                 int x=10, *a,**b;                 int arr[5];                 //poin

program for decode the encoded numbering format into message