Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test
//gcc 5.4.0 #include <stdio.h> // HW 2 Function prototypes unsigned int stringLength(char *str); int stringSearch(char *str, char sc); void stringCopy(char *source, char *dest); unsigned int onesCounter(unsigned int number); unsigned int swapHalves(unsigned int number); int ctof(int c); int main(void) { char *str1 = "How long is it?"; // This string contains spaces. Notice how str1 is "defined" using a pointer char str2[100] = "Where is it?"; // Notice how str2 is defined using an array. char search_char = 'r'; // A character you can search for in str2. char str3[100] = ""; // This is an empty string, but storage has been allocated for it. unsigned int oldNum = 0x12345678; // An int (32-bit value) that can be rotated, or have its ones counted. int c = 10; // A temperature in degrees C that can be converted to degrees F. unsigned int length = stringLength(str1); printf("length = %u\n", length); int location = stringSearch(str2, search_char); printf("location = %d\n", location); printf("Here is str3: %s\n", str3); stringCopy(str2, str3); printf("No, here is str3: %s\n", str3); unsigned int numberOfOnes = onesCounter(oldNum); printf("The number %x has %d ones in its binary representation\n", oldNum, numberOfOnes); unsigned int newNum = swapHalves(oldNum); printf("When you swap the halves of %x, you get %x\n", oldNum, newNum); int f = ctof(c); printf("%d degrees C = %d degrees F", c, f); return 0; } unsigned int stringLength(char *str) { } int stringSearch(char *str, char sc) { } void stringCopy(char *source, char *dest) { } unsigned int onesCounter(unsigned int number) { int i; } unsigned int swapHalves(unsigned int number) { } int ctof(int c) { }
run
|
edit
|
history
|
help
0
2.1.2 Sum of all the elements in a one dimensional array A using reduction.
json string formatter
Présentation
Simple Fork
Fgets and String Stuff
18BCE2182 ASSESS_1 Q2-2
detonadisimo
PRIMER PROGRAMA CON MALLOC()
B_141118_Euclides
18BCE2182 ASSESS_2 Q4