C language cheat sheet pdf


















There are only 32 keywords available in C. The C character set consists of upper and lowercase alphabets, digits, special characters and white spaces, altogether called as the alphanumeric character. This can denotes any alphabet, digit or special symbol used to represent information. Following are the valid alphabets, numbers and special symbols allowed in C.

Certain non printing characters as well as the backslash and the apostrophe ' , can be expressed in terms of escape sequence. General form of scanf function is :. Format string contains placeholders for variables that we intend to receive from keyboard. Character strings are exceptions from this rule.

They will not come with this sign before them. Note: You are not allowed to insert any additional characters in format string other than placeholders and some special characters. Entering even a space or other undesired character will cause your program to work incorrectly and the results will be unexpected.

So make sure you just insert placeholder characters in scanf format string. Split sep, StringSplitOptions. None ;. Checks whether the first character of string is same as specified character. This method returns substring. Substring 1, 7 ;. Converts string into char array.

It removes extra whitespaces from beginning and ending of string. Trim ;. Only available by code in the same class or struct. Only accessible by code in the same class or struct or a derived class. Accessible by any code in the same assembly, but not from another assembly.

Accessible by any code in the same assembly, or by any derived class in another assembly. Indicates that the modified method, lambda expression, or anonymous method is asynchronous. Specifies that the value of the field or the local variable cannot be modified constant. Declares an event. Indicates that the method is implemented externally. Explicitly hides a member inherited from a base class. Provides a new implementation of a virtual member inherited from a base class.

Defines partial classes, structs, and methods throughout the same assembly. Specifies that a class cannot be inherited. Declares an unsafe context. Time will be Format specifier. Short date pattern. Long date pattern. For example, the custom format string for the invariant culture is "dddd, dd MMMM yyyy. Represents a combination of the long date D and short time t patterns, separated by a space. Represents a combination of the short date d and long time T patterns, separated by a space.

Month day pattern. For example, the custom format string for the invariant culture is "MMMM dd. RFC pattern. Short time pattern. For example, the custom format string for the invariant culture is "HH:mm. Long time pattern. For example, the custom format string for the invariant culture is "HH:mm: ss". Year month pattern. For example, the custom format string for the invariant culture is "yyyy MMMM". Custom format. Any other single character. Unknown specifier. An unknown specifier throws a runtime format exception.

Checks whether the Array is read-only. Checks whether access to the Array is synchronized thread safe. Gets the total number of elements in all the dimensions of the Array. Length in bit integer. Gets an object used to synchronize Array access. Returns a read-only wrapper for the specified array. AsReadOnly arrVal ;. Searches a value in a one-dimensional sorted array using a binary search algorithm. BinarySearch arrVal, obj ; where obj is the object to be searched. Sets a range of elements in an array to the default value of each element type.

Clear arrVal, 0, 2 ; If arrVal is an array of integers, the elements at position 0 to 2 will be set to zero after doing Clear. Create a shallow copy of the Array. Clone arrVal ;. ConstrainedCopy srcArr, 0, destArr, 3, 5 ; where srcArr is the source array, 0 is the start index from where copy should begin, destArr is the destination array, 3 is the place where copy should start in the destination array, 5 is the number of elements to copy.

Converts an array of one data type to an array of another data type. Copy srcArr, destArr, 2 ; copies first two elements from srcArr to destArr. CopyTo destArr, 4 ; copy starts from index 4. Initializes a new instance of the Array class. CreateInstance typeof String , length ;. Returns an empty array. Determines whether the specified object is equal to the current object. Equals arrVal2 ;. Retrieves all the elements that match the conditions defined by the specified predicate.

Loops through each element of the array and performs the specified action. ForEach arrVal, Action. Returns an IEnumerator for the Array. GetLength i where i is an integer. GetLongLength i where i is an integer. Gets the index of the first element of the specified dimension in the array. GetLowerBound i where i is an integer. Gets the Type of the current instance. Gets the index of the last element of the specified dimension in the array. GetUpperBound i where i is an integer.

Gets the value of the specified element in the current Array. IndexOf object. LastIndexOf i. Creates a shallow copy of the current Object. Changes the number of elements of a one-dimensional array to the specified new size.

Resize ref arrVal, len-2 ; where len is the original length of the array. Reverses the order of the elements in a one-dimensional Array or in a portion of the Array. Sets the specified element in the current Array to the specified value. SetValue arrVal[i]. Sorts the elements in a one-dimensional array. Sort arrVal. Returns a string that represents the current object. Inherited from Object.

Gets or sets the number of elements that the ArrayList can contain. Gets the number of elements actually contained in the ArrayList. Gets a value indicating whether the ArrayList has a fixed size. Returns whether the ArrayList is read-only. Gets or sets the element at the specified index. Add object value. Adds an object to the end of the ArrayList. AddRange ICollection c ;. Adds the elements of an ICollection to the end of the ArrayList.

Clear ;. Removes all elements of an ArrayList. Contains object item ;. Checks whether an element is in the ArrayList. GetRange int index, int count ;. The cheatsheet focus is both on the language as well as common classes from the standard library. Any comments and feedback are appreciated. Function parameters and return values may be of any type. A function must either be declared or defined before it is used.

It may be declared first and defined later. Every program consists of a set of a set of global variable declarations and a set of function definitions possibly in separate files , one of which must be:. By convention, main returns status 0 if successful, 1 or higher for errors. Functions with different parameters may have the same name overloading. Operators except Precedence order is not affected. New operators may not be created. Operators are grouped by precedence, highest first.



0コメント

  • 1000 / 1000