This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| void swap(char*a,char*b) | |
| { | |
| char t; | |
| t = *a; | |
| *a=*b; | |
| *b=t; | |
| } | |
| void permute(char* s, int i, int n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| char *s = "welcome to linux shell !"; | |
| char t[100]; | |
| //output = welcome to linux shell ! | |
| int main() | |
| { | |
| int i,j,flag=0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<stdlib.h> | |
| typedef struct node{ | |
| struct node* left; | |
| struct node* right; | |
| int value; | |
| }treenode; | |
| int add_node(treenode**tree, int value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void finddepth(Node *node,int depth){ | |
| if(node!=NULL){ | |
| depth=max(finddepth(node->left,depth+1), finddepth(node->right,depth+1) ); | |
| } | |
| return depth; | |
| } | |
| On Mon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<string.h> | |
| char s[] = "rohit"; | |
| void reverse(int); | |
| int main() | |
| { | |
| printf("%s",s); | |
| reverse(0); | |
| printf("\n"); | |
| printf("%s",s); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test gist application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // creates a binary search tree | |
| #include<stdio.h> | |
| #include<stdlib.h> | |
| typedef struct node{ | |
| struct node* left; | |
| struct node* right; | |
| int value; | |
| }treenode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .namespace [] | |
| .sub main | |
| $P1 = subclass 'String', 'jsString' # subclass default string pmc into jsString type | |
| addattribute $P1, 'primitive' | |
| $P7 = box "ROHIT" | |
| $P2 = new 'jsString' # instantiate the new string object | |
| setattribute $P2, "primitive", $P7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var indentChar = ' '; //4 spaces | |
| function idt (lvl) { | |
| if (lvl < 0) lvl = 0; | |
| return Array(lvl+1).join(indentChar); | |
| } | |
| var codegens = exports.nodes = { | |
| 'Empty': function Empty_codegen () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var protoParser = require("./js/parser").parser, | |
| nodes = require("./js/nodes"), | |
| codegen = require("./js/codegen"); | |
| function Compiler () { | |
| var constructors = {}, | |
| prototypes = {}; | |
| // Define AST nodes |