summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.markdown2
-rw-r--r--c.html.markdown44
-rw-r--r--json.html.markdown6
3 files changed, 49 insertions, 3 deletions
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!
diff --git a/c.html.markdown b/c.html.markdown
index 345dca7f..3339032f 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"]
---
@@ -316,7 +317,29 @@ int main (int argc, char** argv)
exit(-1);
break;
}
-
+ /*
+ using "goto" in C
+ */
+ 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);
+ /*
+ https://ideone.com/GuPhd6
+ this will print out "Error occured at i = 52 & j = 99."
+ */
+
+
///////////////////////////////////////
// Typecasting
///////////////////////////////////////
@@ -482,7 +505,24 @@ char c[] = "This is a test.";
str_reverse(c);
printf("%s\n", c); // => ".tset a si sihT"
*/
-
+/*
+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 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() {
diff --git a/json.html.markdown b/json.html.markdown
index a1629137..b5e36090 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
@@ -16,6 +17,11 @@ but they should be avoided for better compatibility.
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",