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

Described the differences among a C++ struct & C++ class? A: The default member & base class access specifies are distinct. It is one of the commonly misunderstood aspects of C+

solution of problem based on poiter

Problem 1. Explain Break and continue statements in C++. Explanation of Break statement Explanation of Continue statement 2. Explain concepts of constructors and

Define the Double Data Type of c Language? The double is used to define BIG floating point numbers and it reserves twice the storage for the number. When the accuracy provided

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Question: (a) Describe what are dynamic pointers. Show their memory representations diagrammatically. (b) Write short notes about pointers in arrays, paying attention on

code for solving optimal solution for matrix

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes