language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "ord.h"
#define TAM 1000000
int tam_heap;
int vetor[TAM];
void gera() {
int i;
for (i = 0; i < TAM; i++)
vetor[i] = rand();
}
void selection_sort() {
int current, i, aux, k;
for (i = 0; i <= TAM-2; i++)
... |
C | /* main.c */
#include <stdio.h>
#include <stdlib.h>
#include "y.tab.h"
#include "DeclaratorList.h"
extern int yyparse();
extern void scanString(const char * buffer);
DeclaratorList declarartorList;
typedef struct {
unsigned int length;
unsigned char *buffer;
} String;
String* load_file(char * s)
{
String *r... |
C | #include <stdio.h>
#include "Bytecode.h"
#include "TBLRDpostincf.h"
#include "CException.h"
unsigned char FSR[0x1000];
int Table[0x200000];
int tblrdpostincf(Bytecode *code) {
/*
* table read post increment
* Input: value from table
* Return: FSR[TBLPTRH] FSR[TBLPTRL] FSR[TBLPTRU] and next value of table an... |
C | #include<stdio.h>
int gameOfThrones(int d) {
int sum=0,num=0,N=1;
while(sum<d) {
sum+=N;
num=N++;
if(sum == d) return num;
}
return num;
}
int main() {
int t,d;
scanf("%d",&t);
while(t--) {
scanf("%d",&d);
char *s[] = {"SL","LB","BS"};
printf("%s\n",s[gameOfThrones(d)%3]);
}
}
|
C | /* Do not remove the headers from this file! see /USAGE for more info. */
object this_body();
mixed get_user_variable(string varname);
//: FUNCTION cannonical_form
// Change object path names to standard form, stripping the trailing .c, if
// any, the clone number, if any, and making sure the leading / exists.
//
// ... |
C | /*
* config_map.c
*
* Created on: 4 Apr 2010
* Author: David
*/
#include "../dt_logger.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "config_map.h"
#include "strmap/StrMap.h"
/*
* create_config_value_int
*
* Each possible integer value from the config file should be contained... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* options.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <mines.h>
int main(int argc, char **argv){
// seeding the rand
srand(time(NULL));
table t;
fill_table(&t);
printf("\n");
int i,j;
do{
system(CLEAR);
plot_table(t);
printf("Please pick your line and column\nType 0 0 to end\n");
scanf("%d... |
C | #include <stdio.h>
void affecter(int *pt_valeur, int a){
*pt_valeur=a;
}
int main(){
int a,valeur=10;
printf("entrer la valeure de a\n");
scanf("%d",&a);
printf("valeur =%d",valeur);
affecter(&valeur,a);
printf("valeur =%d",valeur);
}
|
C | #include <stdio.h>
int bubbleSort(int *arr){
// int size = sizeof() / sizeof(int);
int temp;
for(int i = 0; i < 5;i++)
for (int j = 0; j <= i; j++)
{
if(arr[i] > arr[j] ){
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
retu... |
C | #include <stdio.h>
void main()
{
int dec,i,a[32],rem;
printf("enter the decimal number:\n");
scanf("%d",&dec);
for(i=0 ;dec>0 ;i++ )
{
rem=dec%2;
a[i]=rem;
dec=dec/2;
}
for(i=i-1;i>=0;i--)
printf("%d",a[i]);
printf("\n");
}
|
C | //using nested structure
// making of account
#include<conio.h>
#include<stdio.h>
#include<string.h>
struct user_account
{
char fstnme[40];
char lstnme[30];
char usrnme[50];
char passwd[50];
struct DOB{
int day;
int month;
int year;
}dob; // vriable name as array
struct Gender{
... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char k[10];
int i,len;
scanf("%s",k);
len=strlen(k);
for(i=len-1;i>=0;i--)
{
printf("%c",k[i]);
}
}
|
C | /* See LICENSE file for copyright and license details. */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "util.h"
static bool unary(const char *, const char *);
static bool binary(const char *, const char *, const char *);
static void ... |
C | #include "stack.h"
#include "string.h"
#include <stdio.h>
int16_t stack_init(stack_t * stack, void * array, uint16_t size, uint8_t element_size){
stack->array = array;
stack->size = size;
stack->element_size = element_size;
stack->index = 0;
return 0;
}
int16_t stack_push(stack_t * stack, void * ... |
C | #include <stdalign.h>
#ifndef VMATH_H
#define VMATH_H
typedef struct {
alignas(16) float data[4];
} vec_t;
typedef struct {
alignas(16) float data[4][4];
} mat_t;
vec_t v3neg(vec_t v);
vec_t v3av3(vec_t a, vec_t b);
vec_t v3sv3(vec_t a, vec_t b);
float v3dv3(vec_t a, vec_t b);
vec_t v3xv3(vec_t a, vec_t b);
mat... |
C | /**
* @file
* @brief
*
* @date 29.03.2012
* @author Andrey Gazukin
*/
#ifndef FAT_H_
#define FAT_H_
#include <stdint.h>
#include <sys/types.h>
#include <fs/mbr.h>
#define DIR_SEPARATOR '/' /* character separating directory components*/
#define ROOT_DIR "/"
#define MSDOS_NAME 11
#define MSDOS_DOT... |
C | /*
** dup_before_exec.c for 42sh in /home/anthony/documents/repository/PSU_2015_42sh/src/execution/exec
**
** Made by anthony
** Login <anthony@epitech.net>
**
** Started on Wed May 11 13:46:13 2016 anthony
** Last update Wed Jun 8 21:14:37 2016 teisse_m
*/
#include <stdlib.h>
#include <stdbool.h>
#include "enviro... |
C |
#include <string.h>
#include <stdio.h>
#include <errno.h>
/**
* 字符串缓冲中裂开
*/
int split(char *string, int stringlen, char **tokens, int maxtokens, char delim)
{
int i, tok = 0;
int tokstart = 1; /* first token is right at start of string */
if (string == NULL || tokens == NULL)
goto einval_error;... |
C | #include<math.h>
int solution(int A[], int N){
int min = 1e6, i, j, temp, v1, v2;
for(i =0;i<N-1;i++) for(j =i+1;j<N;j++) {
temp = abs(A[i]-A[j]);
if (temp<min) min = temp, v1= A[i], v2 = A[j];
}
// printf("%d %d\n", v1, v2); Numbers in consideration
return min;
}
int main(int argc, char const *argv[])
{
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct{
int x;
int y;
}point;
int finding_quadrant (point coord) {
if(coord.x >= 0 && coord.y >= 0){
return 0;
}
if(coord.x < 0 && coord.y >= 0){
return 1;
}
if(coord.x < 0 && coord.y < 0){
return 2;
}
if(coord.... |
C | //
// Created by Martin Bobcik, xbobci00
// reseni projektu 2 do IOS
// Date: Duben 2016
//
//includy
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <wait.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/shm.h>
#include <sys/ipc... |
C | /*
Potion of Giantkind
File: tallpotion.c
Date: 3/24/02
Author: Feldegast
Description:
Increases height.
*/
#include "/players/feldegast/defines.h"
inherit "/obj/treasure.c";
void reset(int arg)
{
if(arg) return;
set_id("potion");
set_alias("potion of giantkind");
set_short("Potion of Giantkind");
set_lo... |
C | #include <stdio.h>
typedef long long ll;
#define MAXN 1000000
ll e[MAXN];
void eratos()
{
ll i, j;
for (i = 0; i < MAXN; i++) e[i] = 1; // Merkjum allar tölur sem 'óséðar'.
e[0] = e[1] = 0; // Merkjum núll og ... |
C | #include <pic18f4520.h>
#include "lcd.h"
void oled_init(void)
{
_rs_pin = 0;
_rw_pin = 0;
_en_pin = 0;
oled_write_command(0x38); //FUNCTION SET INSTRUCTION
oled_write_command(0x08); //Display on/off control (off)
oled_write_command(0x01); //Display Clear
oled_write_command(0x0c); //Displ... |
C | #include <math.h>
#include <stdlib.h>
#include "utone.h"
int ut_noise_create(ut_noise **ns)
{
*ns = malloc(sizeof(ut_noise));
return UT_OK;
}
int ut_noise_init(ut_data *ut, ut_noise *ns)
{
ns->amp = 1.0;
return UT_OK;
}
int ut_noise_compute(ut_data *ut, ut_noise *ns, UTFLOAT *in, UTFLOAT *out)
{
... |
C | // Cezary Stajszczyk 317354
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include "traceroute.h"
int main(int argc, char* argv[]) {
if (argc != 2) {
fprintf(stderr, "Usege: sudo ./traceroute [address]\n");
r... |
C | /* Partner 1 Name & E-mail: Dishon Jordan djord007@ucr.edu
* Partner 2 Name & E-mail: Travis Nasser tnass001@ucr.edu
* Lab Section: 025
* Assignment: Lab 11 Exercise 2
* Exercise Description:
* Use the LCD code, along with a button and/or time delay to display the message
* "CS120B is Legend... wait for it DARY!" The ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <stdarg.h>
#ifndef _WIN32
#include <pthread.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include <signal.h>
#endif
#include "sacagalib.h"
#ifdef ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int nb1,nb2,nb3;
int tmp=0;
printf("Nombre 1= ");
scanf("%d", &nb1);
printf("Nombre 2= ");
scanf("%d", &nb2);
printf("Nombre 3= ");
scanf("%d", &nb3);
printf("Init %d, %d, %d\n", nb1, nb2, nb3);
if(nb1<nb2){... |
C | #define _WIN32_WINNT 0x0500
#define WIN32_LEAN_AND_MEAN
#include <winstrct.h>
#include <winioctl.h>
#include <stdlib.h>
/*
#ifdef _DLL
#pragma comment(lib, "minwcrt.lib")
#endif
*/
int
main(int argc, char **argv)
{
LARGE_INTEGER FileSize;
HANDLE hFile;
char cSuffix;
BOOL bSetSparse = FALSE;
DWORD dw;
if... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int age = 25, argent = 8001;
if(age >= 30 || argent >= 8000)
{
printf("Vous etes accepte comme client \n");
}
else
{
printf("hors de ma vue \n");
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
double get_Value();
int main() {
double x = get_Value();
double y = get_Value();
printf("%lf %lf", x, y);
FILE* out;
out = fopen("results.txt", "w");
if (out == NULL) {
printf("Cannot open file!\n");
exit(1);
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINE_LEN 1024
int main () {
char line [MAX_LINE_LEN];
FILE *in = fopen ("a", "r");
if (!in) exit (EXIT_FAILURE);
while (fgets(line, MAX_LINE_LEN, in) != NULL) {
char *sep = strchr(line , ':');
if (!sep) exit (EXIT_F... |
C | //insert a word taken by user in a sentence after no of words that count should taken by the user
#include<stdio.h>
#include<string.h>
int main()
{
int l1,l2,k1,i,j,flag=0;
char a[50]="hi hello how are you friends";
printf("before:::: %s\n",a);
char b[20];
l1=strlen(a);
int count,e=0;
printf("enter a word\n"... |
C | /*
** EPITECH PROJECT, 2020
** Dante's Star (solver)
** File description:
** astar_neighbours.c -- No description
*/
#include <limits.h>
#include <stddef.h>
#include "solver.h"
static int get_y(direction_t dir, anode_t *parent)
{
switch (dir) {
case LEFT:
case RIGHT: return parent->y;
cas... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
static int myCompare (const void * a, const void * b)
{
return strcmp (*(const char **) a, *(const char **) b);
}
void sort_func(char* file_name)
{
char ch;
char arr[100][1000];
char line[100];
FILE *fp;
fp = fopen(file_name, "... |
C | /*4、c语言中有一个函数strstr(3)的功能是在字符串中找子串
,尝试自己定义一个函数实现其功能*/
#include <stdio.h>
#include <string.h>
int findStr1(char *s,char *l);
int main()
{
char s[100] = "";
char l[10]="";
char *p;
printf("请输入源字符串:");
gets(s);
//scanf("%s",s);
printf("请输入要查找的字符串:");
gets(l);
//scanf("%s",l);
findSt... |
C | /*!
* \file ringbuf.c
* \brief Implementation of ring buffer data structure.
*
* \date create: 2011/8/25
* \author hac <Ping-Jhih Chen>
* \sa ringbuf.h
*/
/* generic */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#includ... |
C | #include <stdio.h>
int main(void)
{
int no;
printf("enter the number:");
scanf("%d",&no);
no+=1;
while(no%10!=0)
{
no=no+1;
}
printf("\n%d",no);
return 0;
}
|
C | /* Checks that BOLT correctly processes a user-provided function list file,
* reorder functions according to this list, update hot_start and hot_end
* symbols and insert a function to perform hot text mapping during program
* startup.
*/
#include <stdio.h>
int foo(int x) {
return x + 1;
}
int fib(int x) {
if ... |
C | /*
* A small program that illustrates how to call the maxofthree function we wrote in
* assembly language.
*/
// compile by: gcc wc.c asm_wc.o
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
int64_t wc(char* s);
int main(int argc, char *argv[]) {
// file handle
FILE *fh;
// open file ... |
C | /*
* video.c
*
* Implementation of video.h functions
*
*/
#include "video.h"
#include <math.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
/*----------------------------------------------------------------------------------------------------------*/
void convert_grayscale_to_rgb(unsigned char *... |
C | // Lista 5
// 14/02/2017
// Andrew Pacheco Silveira (andrew-pacheco@hotmail.com) / Franciune Barbosa da Silva de Almeida (franciuine@gmail.com)
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
typedef struct pessoa{
char nome[20];
int idade;
}PESSOA;
typedef struct arvore{
PESSOA *p;
str... |
C | #include "nst_genhash.h"
#include <nst_bjhash.h>
#include <nst_allocator.h>
#include <nst_errno.h>
#include <nst_assert.h>
#include <nst_string.h>
#include <string.h>
#define NST_GENHASH_MIN_SIZE (64)
#define NST_GENHASH_MAX_SIZE (2048 * 1024) /* 2048 K maximum */
#define NST_GENHASH_DF_MIN_FILL_FACTOR 5
#define... |
C | #ifndef NODE_H
#define NODE_H
#include <stdbool.h>
#include <stdio.h>
struct node {
char *string;
int number;
struct node *next;
};
typedef int (*node_compare)(const void *a, const void *b);
// the above defines the type node_compare as a pointer to a
// function that takes two void pointers as argu... |
C | #include<stdio.h>
int main()
{
unsigned int T, i, a, b, c;
scanf("%u", &T);
for(i=1; i<=T; ++i)
{
scanf("%u %u %u", &a, &b, &c);
if(a>b && a>c)
{
printf("Case %u: %u\n", i, b>c?b:c);
}
else if(b > c)
{
printf("Case %u: %u\n", i, c>a?c:a);
}
else
{
printf("Case %u: ... |
C | #include<stdio.h>
int main()
{
int n,i;
printf("\n Enter the number : "); //input
scanf("%d",&n);
for(i=1;i<=10;i++)
printf("\n %dX%d=%d",n,i,n*i); //running the loop from 1 to 10
printf("\n\n");
return 0;
}
|
C | /**
* Stack 利用 Vector 实现栈
*/
#ifndef DATA_STRUCTURES_STACK_H
#define DATA_STRUCTURES_STACK_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../vector/Vector.h"
typedef struct stack stack;
/**
* 创建一个空栈
* @return stack - 栈
*/
stack *new_stack();
/**
* 获取栈的大小
* @param stk - 栈
* @return ... |
C | #include <stdio.h>
int main(void){
double cel_deg = 0.0;
printf("摂氏温度を入力:");
scanf("%lf", &cel_deg);
double fah_deg = ((cel_deg * 9) / 5) + 32;
printf("摂氏%.2lf度は華氏%.2lf度となる。\n", cel_deg, fah_deg);
return 0;
}
|
C | #include "screen.h"
#include "ports.h"
#include "../libc/mem.h"
static const char banner[] = "\n __ __ __ "
"\n _______ __/ /_ _____/ /__________ _/ /_____ _ "
... |
C | #include <stdlib.h>
#include <stdio.h>
#include "persona.h"
int init(ePersona per[],int CANT){
int i;
int retorno=-1;
for(i=0;i<CANT;i++){
per[i].isEmpty=1;
retorno=0;
}
return retorno;
}
int obtenerEspacioLibre(ePersona per[], int CANT)
{
int i,retorno=-1;
... |
C | #include <stdio.h>
#include "DoublyList.h"
List DoublyListSwap(List L);
int main()
{
List L;
int n,i;
n = 2;
printf("Please enter the element of L\n");
L = CreateList(n);
PrintList(L);
L = DoublyListSwap(L);
PrintList(L);
return 0;
}
List DoublyListSwap(List L)
{
Position P;
P = L->Next;
P = P->Next;
P... |
C | #include <stdio.h>
void main(void)
{
int a = 3, b = 4;
if (5 > 3 && b > a)
{
printf("ù ° if \n");
}
if (4 > 3 || b > a)
printf(" ° if \n");
if (!(a > b))
{
printf(" ° if \n");
}
} |
C | /******************************************************************************/
// I N T E R F A C E S . H //
// D P X //
/****************************************************************************... |
C | /**
* @file
*
* \if de
* Ein einfaches Testprojekt zur Überprüfung der Tasterwerte. Es gibt alle
* 500ms den aktuellen Analogwert der Taster über die UART/IR-Schnittstelle
* aus. \n
* Vergleichswerte gibt es im AsuroWiki unter:
* http://www.asurowiki.de/pmwiki/pmwiki.php/Main/Tasten
* \endif
*
*... |
C | #include "stm32f4xx.h"
#include "LCD_drivers.h"
#include "delay.h"
//------------------------------------------------------------------------------
// To send command to the LCD in 4 bit mode
void LCD4bit_Cmd(unsigned char command){
LCD_write4bit(command & 0xF0,0);
LCD_write4bit(command<<4,0);
if (command<4)
de... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strtrim.c :+: :+: :+: ... |
C | /*
* Unix System Programming Examples / Exemplier de programmation système Unix
*
* Copyright (C) 1995-2022 Alain Lebret <alain.lebret [at] ensicaen [dot] fr>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a ... |
C | #include "utils.h"
void generate_init_point(double *x, int n) {
int b = 3;
for(int i = 0; i < n; i++) {
x[i] = (double)(rand() % (b + 1));
}
}
/*----- Función 4 -----*/
void get_gradient_sm(double *g, double *x, double *y, double lambda, int n) {
g[0] = 2.0 * (x[0] - y[0]) - 2.0 * lambda * (x[1] - x[0]);
g[n -... |
C | #include <string.h>
#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
int main(int argc, string argv[])
{
//expecting name of the program and one user argument only
if(argc != 2){
printf("error, only one non-negative integer can be passed");
return 1;
}
else
{
printf("plai... |
C | #include <fcntl.h>
#include <errno.h>
#include <err.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <emmintrin.h>
#include <mmintrin.h>
void Scan(float*);
int main(int argc, char *argv[])
{
if (argc < 5) {
... |
C | #include "virt_mem_management.h"
#include "lib.h"
# define TEST_SIZE 2048
void mem_tester(void)
{
char *ptr[TEST_SIZE];
size_t i = 0;
size_t j = 1;
if (kmalloc(0) != NULL || vmalloc(0) != NULL)
{
printk("error ! Null ptr excepted\n");
return ;
}
printk("==================================\n");
// error tes... |
C | #ifndef MTYPES_H
#define MTYPES_H
/// ġ
struct MPOINT{
int x, y;
public:
MPOINT(void){}
MPOINT(int x, int y){ MPOINT::x = x, MPOINT::y = y; }
void Scale(float x, float y);
void ScaleRes(void); ///< 648*480ذ ػ ϸ
void TranslateRes(void); ///< 648*480 ߽ Ÿŭ ػ ° ̵
};
///
struct MRECT{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <math.h>
typedef struct coordinate {
int x;
int y;
} coordinate;
typedef struct server_message {
coordinate pos;
coordinate adv_pos;
int object_count;
coordinate object_pos[4];
} ... |
C | /*/
* ARCHIVO:
* logistica.c
creacion:2009/08/28
* modificacin: 2009/08/30
modificacin: 2009/09/01
modificacin: 2009/09/03
* --------------------------------------------------------------------------------------
* DESCRIPCION:
* Este archivo contiene el codigo fuente de la parte del proyecto del
... |
C | #include"time_to_s.h"
SysTime_t CONST_TIME = {1970,1,1,0,0,0,0};
bool CheckIsRunYear( uint16_t year)
{
bool bRet = false;
if( ((0 == year%4) && (year%100!=0)) || (0 == year%400))
bRet = true;
return bRet;
}
uint32_t DateSwSec(SysTime_t date)
{
uint32_t retSec = 0;
uint32_t RunYearNum = 0;
if(date.year<CONST_... |
C | /* Auteur :
Axel ARCHAMBAULT 3300807
Anas EZOUHRI 3208760
Bilel AFFES 3361270 */
#ifndef STRCT_MODULE_H
#define STRCT_MODULE_H
#include <linux/dcache.h>
#include <linux/workqueue.h>
#include <linux/syscalls.h>
#include <linux/sysinfo.h>
#include <linux/module.h>
#include ... |
C | // delete a node from the AVL tree
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
struct node {
int key;
int height;
struct node *lc;
struct node *rc;
struct node *pr;
};
#include "45printBinaryTree.h"
// ***** INSERTING INTO AVL ***** //
// function decalarations for AVL insert
void insertAVL(struct ... |
C | #include<stdio.h>
#include<string.h>
#define MAXLINE 1000
int getLine (char s[], int maxLen);
void reverse ( char to[], char from[] );
int getLine(char s[], int maxLen)
{
int c,i;
for ( i = 0 ; i < maxLen-1 && ( ( c = getchar() ) != EOF ) && c != '\n' ; ++i)
{
s[i] = c;
}
if ( c == '\n')
{
s[i] = '\n';
}
... |
C | #include <stdio.h>
int columna(char c){
if(c =='+' || c == '-')
return 0;
if(c == '0')
return 1;
if(c >= '1' && c <= '9')
return 2;
return 3;
}
int pasarValor(char s[]){
int i = 0;
int numero = 0;
if(s[0] != '+' && s[0] != '-')
i = 0;
else
i = 1;
while(s[i]){
numero = numer... |
C | /*
* Array QָʾһԪصλַ
* pointer ++ĄĕrᘌָY͑BӜp
* ӑBgĕrǂgheap, ҂Ȼָ׃stack
* :
* int *ptr = malloc(sizeof(int) * 100);
* malloc ҂ӛwеheap^Ҫȡ sizeof(int) * 100 @ӴСĿg
* ptr@׃Ǵeأ @׃Ǵstack!
*
*/
#include<stdio.h>
#include<stdlib.h>
int main()
{
int(*ptr)[4] = malloc(sizeof(int) * 10);
printf("\nsizeof *ptr :... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <poll.h>
#include <errno.h>
#include <ctype.h>
#define MAXLINE 80
#define SERV_PORT 8888
#define OPEN_MAX 1024
int main(int argc, char *argv[])
{
int i, j, maxi, listenfd, connfd, sockfd;
int nre... |
C | /*
* The MIT License (MIT)
*
* Copyright (c) 2016 Wang Jian
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, co... |
C | #define _XOPEN_SOURCE 500
#include <stdlib.h>
#include <sys/mman.h>
#include <unistd.h>
#include <semaphore.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include "lib.h"
int lib_create(const char *name){
int shmid = shm_open(name, O_RDWR | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO);
... |
C | #include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include "note.h"
#define SIZE 0x100
char active_notes[SIZE][2][7];
void activenotes_load() {
memset(active_notes, 0, sizeof(active_notes));
}
void activenotes_add(NOTE *n) {
active_notes[n->note][n->sharp][n->octave] = 1;
}
void acti... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define MIN 10
#define MAX 1000
struct lista;
typedef struct lista *pok;
typedef struct lista{
int br;
pok next;
}Brojevi;
pok CreateNode();
void IspisListe(pok);
void UbaciUListu(pok,int);
void UbaciNaKraj(pok,int);
int main()
{
... |
C | /*
Assigned by:
Student 1: Melinda Levi ID:201310356
Student 2: Kostya Lokshin ID:310765821
Lecturer: Costa Mirkin 61104-62
Targil: Shimon Aviram 661104-61 / Lior Levi 661104-63
*/
#include <stdio.h>
#include "binary_srch_tree.h"
#include "dlist_b.h"
///////////////////////////////////////////////////////////////
b... |
C | /*
+----------------------------------------------------------------------+
| PHP2C -- utility.h |
+----------------------------------------------------------------------+
| Autori: BAVARO Gianvito |
| CAPURSO Domenico |
| DONVITO Marcello |
+----------------------------------------------------------------------+
*/
/... |
C | #include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *next;
};
struct queue
{
struct node *rear;
struct node *front;
};
void initial(struct queue *);
void qadd(struct queue *, int);
int qdel(struct queue *);
void dis(struct queue *);
void push(int);
void pop();
void displayFunc... |
C | /*
* ds3231.c
*
* Created on: Oct 27, 2014
* Author: lim
*/
#include "ds3231.h"
#include "i2c.h"
#define DS13xx_I2C_ADDRESS 0x68
TTime ttime(uint8_t hour, uint8_t min, uint8_t sec) {
TTime result;
result.sec = sec;
result.min = min;
result.hour = hour;
return result;
}
TDate tdate(uint8_t weekday, u... |
C | #include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include "randfile.h"
void printbar(){
printf("============================================================================\n");
}
// A main function that:
// Populates an array with 10 random numbers... |
C | #include<stdio.h>
int fib ()
{ int num;
int a = 0 , b = 1 ;
printf("Enter the number of terms");
scanf("%d", &num);
printf("%d %d ",a,b);
for(int i = 2 ; i < num ; i++)
{
int m;
m = a + b ;
printf("%d\t",m);
a = b ;
b = m ;
}
}
in... |
C | //实验三 预测分析法
#include <stdio.h>
char ch[20]; //存储输入串
char sign[20]; //符号栈
int digit[20]; //数字栈
int topsign; //符号栈顶指针
int topdigit; //数字栈顶指针
int table[7][7]={{1,1,-1,-1,-1,-1,1}, //二维算符优先关系表
{1,1,-1,-1,-1,-1,1},
{1,1,1,1,-1,-1,1},
{1,1,1,1,-1,-1,1},
{-1,-1,-1,-1,-1,-1,2},
{1,1,1,... |
C | #include <stdio.h>
#define MAX_DEM 3
double a[MAX_DEM][MAX_DEM],b[MAX_DEM],y[MAX_DEM];
void matrix_generator(){
int i,j;
srand(time(NULL));
for(i=0;i<MAX_DEM;++i){
for(j=0;j<MAX_DEM;++j){
a[i][j] = rand()/RAND_MAX*10+1;
}
}
for(i=0;i<MAX_DEM;++i)
b[i] = rand()/... |
C | #pragma once
// This macro exisst so that the cpu and dissassembler can make use of the same
// op switch statment
#define DECODE(op) \
{ \
switch (op) \
{ \
/*loads*/ \
case 0xa1: IndexedIndirectX(); lda(); break; \
case 0xa5: ZeroPage(); lda(); break; \
case 0xa9: Immedia... |
C | #include <stdio.h>
main ()
{
float valor_metros, valor_centimentros;
printf("Insira o valor em metros = ");
scanf("%f", &valor_metros);
valor_centimentros = (valor_metros * 100);
printf("O valor em centmetros = %.2f", valor_centimentros);
return(0);
}
|
C | // ---- Definitions for tree traversal examples ----
#include <vcc.h>
#include <stdlib.h>
typedef
/*D_tag b_node */
struct b_node {
struct b_node * left;
struct b_node * right;
int key;
} BNode;
typedef
/*D_tag l_node */
struct l_node {
struct l_node * next;
int key;
} LNode;
/*D_defs
define pred sorted^(... |
C | #include <stdio.h>
#include <Windows.h>
#include <Shlwapi.h>
#include "builder.h"
#include "exec.h"
#include "getopt.h"
#include "helper.h"
#include "rc4.h"
#define DEFAULT_NAME "out.exe"
#pragma comment(lib, "Shlwapi.lib")
void PrintHelp(LPSTR self) {
PathStripPath(self);
printf(
"Usage:\n"
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
int n;
int* ptr;
scanf("%d", &n);
ptr = (int*) malloc(sizeof(int) *n);
for (int i = 0; i < n; i++)
{
scanf("%d", &ptr[i]);
}
FILE* fptr;
fptr = fopen("squares.txt", "w");
for (int i = n - 1 ; i >=... |
C | #include "types.h"
#include "user.h"
// xv6 provides spin locks only for the kernel modules
// this is userland implementation of spinlocks
// The module alos provides implementation of semphores using sping locks
// ==================== USERLAND SPINLOCKS ===================================
void init_splock(spl... |
C | #include "fractol.h"
int color_in_int(t_color *color)
{
return ((color->r << 16) + (color->g << 8) + (color->b));
}
void modif_color(t_color *color)
{
color->r = rand() % 255;
color->g = rand() % 255;
color->b = rand() % 255;
}
void choose_color(t_color *color, int r, int g, int b)
{
color->r = r;
color->g... |
C | /* Inclusions */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
int main(int argc, char *argv[]) {
int n,z,l;
unsigned int offset,i;
if (argc < 3)
{
fprintf(stderr, "Usage: %s <file_name> <offset>\n", argv[0]);
exi... |
C | #include <stdio.h>
int main(void){
int n[30]={}, num, i;
for(i=0; i<28; i++){
scanf("%d",&num);
n[num-1] = num;
}
for(i=0; i<30; i++){
if(n[i] == 0)
printf("%d\n",i+1);
}
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct PAIR
{
int i;
int j;
int k;
} PAIR;
PAIR ** sols = NULL;
int n_sols = 0;
void check_err(void* a)
{
if(a == NULL)
{
printf("Not enough memory!\n");
exit(1);
}
}
int isMazeLine(char* s, int n)
{
for(int i = 0; i < n; i++)
... |
C | #ifndef BOOK_H
#define BOOK_H
enum status {ENABLE_RENT, DISABLE_RENT};
typedef struct book {
char title[100];
char author[20];
char publisher[20];
char date[11];
char isbn[14];
enum status rentStatus;
} Book;
#endif |
C | void check_arm(int x, int cj, int cd, int cs) {
if(x < 0) {
return;
}
int arm = x == cj * cj * cj + cd * cd * cd + cs * cs * cs;
if(arm) {
printf("DA");
} else {
printf("NE");
}
}
int main() {
int broj, cj, cd, cs;
scanf("%d", &broj);
cj = broj % 10;
cd = (broj / 10) % 10;
cs = (broj / 100) % 10;
chec... |
C | #include "lerr.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char* lerr_describe(enum lerr_code code) {
switch (code) {
case LERR_DEAD_REF: return "dead reference";
case LERR_AST: return "ast error";
case LERR_EVAL: ... |
C | //RAMREZ PALAO MANUEL
#include <stdio.h>
#include <ctype.h>
int main(){
char str[256];
char ch;
int j = 0;
printf("Ingresa una palabra a convertir en miniscula: ");
scanf("%s",str);
while (str[j]){
ch = str[j];
putchar(tolower(ch));
j++;
}
return 0;
}
|
C | #include <string.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char*argv[]){
FILE * fd;
int c;
char* input;
int* tnt = {0,0};
char buf[1024];
scanf("%s",&input);
fd = fopen(input, "r");
if (fd){
while ((c = getc(fd)) != EOF){
}
fclose(fd);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.