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
Explain the terms- Substitutability and Extensibility Substitutability - The objects of a properly derived class can be safely and easily substituted for an object of its


I want Skype Recorder Application + Setup + Sourcecode + NICE UI Project Description: i want an application built which will allow user to record skype audio or video calls

A: This is a name that acts as an alias, or alternative name, for a beforehand defined variable or an object. prepending variable along with "&" symbol makes it as reference. fo


Write a program to calculate the timetable for numbers 1 -> 10 and display them as follows. Your solution should use for do loops      #include stdio.h void main() {    char p

removing jewel from a necklace

Is it possible to pass an entire structure to functions? Yes, it's possible to pass an entire structure to a function in a call by method style. Some programmers prefer to decl

write a program that adds all numbers from 1 to 200

drawbacks in assignments in engeenirng