From 9796759379d77a848ef84f8c1019672b87b90822 Mon Sep 17 00:00:00 2001 From: himanshu81494 Date: Thu, 8 Oct 2015 14:44:10 +0530 Subject: Update c.html.markdown --- c.html.markdown | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/c.html.markdown b/c.html.markdown index db2ac930..b99cfe84 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -472,7 +472,22 @@ char c[] = "This is a test."; str_reverse(c); printf("%s\n", c); // => ".tset a si sihT" */ - +//as we can return return only one variable +//to change values of more than one variables we use call by reference +void swapTwoNumbers(int *a, int *b) +{ +int temp = *a; +*a = *b; +*b = temp; +} +/* +int first = 10; +int second = 20; +printf("first: %d\nsecond: %d\n", first, second); +swapTwoNumbers(&first, &second); +printf("first: %d\nsecond: %d\n", first, second); +// values will be swapped +*/ // if referring to external variables outside function, must use extern keyword. int i = 0; void testFunc() { -- cgit v1.2.3 From 626ee03fc3ca27698044db118bd53f563d22ccd0 Mon Sep 17 00:00:00 2001 From: himanshu81494 Date: Thu, 8 Oct 2015 14:45:16 +0530 Subject: Update c.html.markdown --- c.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/c.html.markdown b/c.html.markdown index b99cfe84..8e1675bb 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -6,6 +6,7 @@ contributors: - ["Árpád Goretity", "http://twitter.com/H2CO3_iOS"] - ["Jakub Trzebiatowski", "http://cbs.stgn.pl"] - ["Marco Scannadinari", "https://marcoms.github.io"] + - ["himanshu", "https://github.com/himanshu81494"] --- -- cgit v1.2.3 From e8248af13431ca87786fff17a605189c69aacf15 Mon Sep 17 00:00:00 2001 From: himanshu81494 Date: Thu, 8 Oct 2015 15:31:40 +0530 Subject: Update c.html.markdown --- c.html.markdown | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/c.html.markdown b/c.html.markdown index 8e1675bb..29bc5a5b 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -307,7 +307,25 @@ int main(void) { exit(-1); break; } - + + // using "goto" + typedef enum { false, true } bool; + // for C don't have bool as data type :( + bool disaster = false; + int i, j; + for(i=0;i<100;++i) + for(j=0;j<100;++j) + { + if((i + j) >= 150) + disaster = true; + if(disaster) + goto error; + } + error : + printf("Error occured at i = %d & j = %d.\n", i, j); + // this will print out "Error occured at i = 52 & j = 99." + + /////////////////////////////////////// // Typecasting /////////////////////////////////////// -- cgit v1.2.3 From 617599a527a7ee9e3d01a21f11338a1cba3e1eb5 Mon Sep 17 00:00:00 2001 From: himanshu81494 Date: Thu, 8 Oct 2015 15:49:51 +0530 Subject: Update json.html.markdown --- json.html.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/json.html.markdown b/json.html.markdown index 6aff2ce2..f4adfc8b 100644 --- a/json.html.markdown +++ b/json.html.markdown @@ -4,6 +4,7 @@ filename: learnjson.json contributors: - ["Anna Harren", "https://github.com/iirelu"] - ["Marco Scannadinari", "https://github.com/marcoms"] + - ["himanshu", "https://github.com/himanshu81494"] --- As JSON is an extremely simple data-interchange format, this is most likely going @@ -13,6 +14,11 @@ JSON in its purest form has no actual comments, but most parsers will accept C-style (`//`, `/* */`) comments. For the purposes of this, however, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. +Data types supported by JSON includes: numbers, string, boolean, array, object and null. +Supporting browsers are: Firefox(Mozilla) 3.5, Internet Explorer 8, Chrome, Opera 10, Safari 4. +JSON file type for JSON files is ".json". The MIME type for JSON text is "application/json" +Drawbacks of JSON include lack of type definition and some sort of DTD. + ```json { "key": "value", -- cgit v1.2.3 From c1c7a96378d79d379e68084780eecd91731fa4bb Mon Sep 17 00:00:00 2001 From: Himanshu81494 Date: Fri, 9 Oct 2015 19:57:06 +0530 Subject: typo in readme --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 774797d5..28fa5093 100644 --- a/README.markdown +++ b/README.markdown @@ -8,7 +8,7 @@ commented code and explained as they go. ... to write more inline code tutorials. Just grab an existing file from this repo and copy the formatting (don't worry, it's all very simple). -Make a new file, send a pull request, and if it passes muster I'll get it up pronto. +Make a new file, send a pull request, and if it passes master I'll get it up pronto. Remember to fill in the "contributors" fields so you get credited properly! -- cgit v1.2.3 From c899b6605ef9667cb214c2163e7182ad41783be4 Mon Sep 17 00:00:00 2001 From: himanshu81494 Date: Fri, 9 Oct 2015 20:59:05 +0530 Subject: Update c.html.markdown --- c.html.markdown | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/c.html.markdown b/c.html.markdown index 29bc5a5b..f35a2098 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -307,8 +307,9 @@ int main(void) { exit(-1); break; } - - // using "goto" + /* + using "goto" in C + */ typedef enum { false, true } bool; // for C don't have bool as data type :( bool disaster = false; @@ -323,7 +324,10 @@ int main(void) { } error : printf("Error occured at i = %d & j = %d.\n", i, j); - // this will print out "Error occured at i = 52 & j = 99." + /* + https://ideone.com/GuPhd6 + this will print out "Error occured at i = 52 & j = 99." + */ /////////////////////////////////////// @@ -491,13 +495,15 @@ char c[] = "This is a test."; str_reverse(c); printf("%s\n", c); // => ".tset a si sihT" */ -//as we can return return only one variable -//to change values of more than one variables we use call by reference +/* +as we can return only one variable +to change values of more than one variables we use call by reference +*/ void swapTwoNumbers(int *a, int *b) { -int temp = *a; -*a = *b; -*b = temp; + int temp = *a; + *a = *b; + *b = temp; } /* int first = 10; -- cgit v1.2.3