language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | # include <stdio.h>
int main(){
int n = 5; //dynamic size
char * pvowels = (char *) malloc(n * sizeof(char));
int i; //iterator
pvowels[0] = 'A'; //store the value of char A to the 0th index of pvowels
pvowels[1] = 'E';
*(pvowels + 2) = 'I'; //store the value of char I to the pointer of the 2n... |
C | #include "method.h"
int problem_129() {
char str[20];
int i, j, len;
printf("ڿ Է: ");
gets(str);
len = 0;
for( i = 0 ; i < 20 ; i++) {
if((str[i] >= 'a' && str[i] <= 'z') || str[i] == ' ' || (str[i]>='A'&&str[i] <='Z')) {
len++;
}
}
printf("ڿ=%d\n", len);
for(i = len ; i > 0 ; i--) {
for(j = 0; ... |
C | #include <pebble.h>
#define KEY_BUTTON 0
#define KEY_VIBRATE 1
#define BUTTON_UP 0
#define BUTTON_SELECT 1
#define BUTTON_DOWN 2
static Window *s_main_window;
static TextLayer *s_text_layer;
static void send(int key, int message)
{
DictionaryIterator *iter;
app_message_outbox_begin(&iter);
dict_wri... |
C | #define _CRT_SECURE_NO_WARNINGS 1
// 2、带头双向循环链表增删查改实现
typedef int LTDataType;
typedef struct ListNode
{
LTDataType _data;
struct ListNode* _next;
struct ListNode* _prev;
}ListNode;
class List
{
public:
List();
~List();
ListNode* BuyNode(LTDataType x);
void ListPushBack(LTDataType x);
void ListPopBack();
void ... |
C | /* vmath.c 96-bit integer and floating point routines for vasm */
/* (c) in 2002 by Frank Wille */
#include "vasm.h"
#include <math.h>
static int96 one = { 1,0,0,0,0,0,0,0,0,0,0,0 };
unsigned char *int96_assign32(unsigned char *x,long val)
{
int i;
for (i=0; i<4; i++) {
x[i] = val & 0xff;
val >>= 8;
... |
C | #include <stdio.h>
#include <assert.h>
#define do_test(f) printf("test : %s ... ",#f);f();
void isPositive();
void isNegative();
int main()
{
printf("Start unit tests\n");
do_test(isPositive);
do_test(isPositive);
do_test(isPositive);
do_test(isNegative);
do_test(isPositive);
return 0;
}
voi... |
C |
#ifndef CLAMP_H_INCLUDED
#define CLAMP_H_INCLUDED
#include "typedefs.h"
/*@
requires bound: lower < upper;
assigns \nothing;
ensures bound: lower <= \result <= upper;
behavior lower_bound:
assumes v < lower;
assigns \nothing;
ensures result: \result == lower;
behavior between:
assumes l... |
C | /*JSTK-320111
a2_p1_m1.c
Tudor Cristian Maiereanu
t.maiereanu@jacobs-university.de*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int integer;
printf("Enter the integer: ");
scanf("%d", &integer);
printf("The decimal notation of the integer you entered is %d\n", integer);
printf... |
C | #include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include "gol.h"
void winDraw(struct GameOfLife *gol)
{
char* iterBuffer = malloc((gol->width + 1) * sizeof(char));
unsigned int y;
clear();
sprintf(iterBuffer, "Iteration: %d", gol->numIteration);
move(0, 0);
addst... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <curses.h>
#include <signal.h>
#include <string.h>
#include <math.h>
#include <time.h>
/* 4
* 1.ʾʱ䣬
* 2.
* 3.ȡʱ
* 4.
*/
WINDOW *wtime,*wnumb;
main()
{
/* ʼ */
initscr();
int id=0;
//3ӽ
for(id;i<3;id++)
{
if(fork())
{
//
}
else
... |
C | /*
* c_swi_handler.c: swi handler in c, call libc according to swi number
*
* Author: Shi Su <shis@andrew.cmu.edu>
* Mengjin Yan <mengjinyan@cmu.edu>
*
* Date: Mon Oct 26 14:03:58 EDT 2015
*/
#include <bits/swi.h>
#include <types.h>
#include <syscall.h>
#include <lock.h>
/* Dispatch the syscall to d... |
C | /**
* gdiopt.c
* Copyright (c) 2014-2015 SWAT
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <stdarg.h>
#include <stdint.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#include <time.h>
FILE *logfd = NULL;
int bin2iso(const char *source, const char *... |
C | /* Example
* Description: Special file example.
* Edited by : Georgi D. Sotirov, gdsotirov@gmail.com
*/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#define BUF_SZ 8192
int main() {
char buf1[BUF_SZ];
char buf2[BUF_SZ];
int fd1;
int fd2;
... |
C | /*-----------------------------------------------------------
recouvrement de processus et attente de terminaison du fils
-------------------------------------------------------------*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
main(int argc,char* argv[],char* arge[])
{
switch (fork()) {
... |
C | #include<stdio.h>
main(){
int i,arr_A[4]={1,2,3,4};
for(i=0; i<4; i++)
printf("%d \n",arr_A[i]);
}
|
C | #include<stdio.h>
#include<sys/wait.h>
#include<unistd.h>
#include<wait.h>
int main(){
pid_t pid, pid1;
pid = fork();
if(pid == 0){//incase child process
execlp("/bin/ls", "ls", NULL);
printf("print after execlp");
}
else if(pid>0){//incase parent process
wait(NULL);
... |
C | /*
* timeouts and clock
*
* time.c
* Changed: <2022-01-04 10:57:54 curt>
*/
#include <types.h>
#include <sys/sys.h>
#include <sys/proc.h>
#include <sys/signal.h>
long seconds = 0; /* system time */
int revel = 0; /* seconds to revelie for sleep system call */
char ticks = 0;
exte... |
C | /*
Copyright (C) 2019-2020 JingWeiZhangHuai <jingweizhanghuai@163.com>
Licensed under the Apache License, Version 2.0; you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri... |
C | #include "stdio.h"
#include "malloc.h"
int* twoSum(int* numbers,int numberSize,int target,int* returnSize){
int i=0,j=numberSize-1;
int* result=malloc(sizeof(int)*2);
for(;i<numberSize-1;i++){
for(;j>i;j--){
int ret=numbers[i]+numbers[j];
if(ret==target){
result[0]... |
C | #include "MLList.h"
#include <stdio.h>
#include <stdlib.h>
void MLList_destroy(MLList *);
void MLList_addLast(MLList *, const void *);
bool MLList_remove(MLList *, int);
void MLList_clear(MLList *);
bool MLList_writeFile(const MLList *, const char *);
bool MLList_readFile(MLList *, const char *);
MLList_Node *MLLis... |
C | /*
* =====================================================================================
*
* Filename: exec.c
*
* Description: shows exec
*
* Version: 1.0.0
* Created: 04/10/2018 09:40:05 AM
* Revision: none
* Compiler: gcc
*
* Author: Ovidiu - Dan Bogat [... |
C | #include <stdio.h>
#include <string.h>
int main()
{
int i, len;
int start, stop;
char string[] = "The University of Aizu";
char *p, *q;
len=strlen(string);
printf("Please input start and stop numbers (1 - %d, start <= stop): ", len);
scanf("%d%d", &start, &stop);
/* 通常の配列添字を使い、配列要素を順次参照する方法 */
fo... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
int main(void)
{
pid_t pid;
int i;
int first_pid=getpid();
printf("pid:%d,PGID:%d\n",getpid(),getpgid(0));
for(i =0;i<3;i++)
{
if((pid= fork())<0)
{
fprintf(stderr,"fork: %s\n",strerror(errno));
exit(1);... |
C | #include <stdio.h>
#include <string.h>
#include <cs50.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
int main(int argc, string argv[]){
int key;
if(argc != 2){
printf("Usage: ./caesar key \n");
return 1;
}
else{
for(int i = 0; i < strlen(argv[1]); i++){
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* visu3.c :+: :+: :+: ... |
C | #include <xc.h>
#include "SPI.h"
/******************************************************************************/
#define SPI_MODE0 0
#define SPI_MODE1 1
#define SPI_MODE2 2
#define SPI_MODE3 3
void SPI_init()
{
//Pinos(18F2550)
TRISCbits.TRISC7 = 0; //SDO
// TRISCbits.TRISC7 = 0; //SDO (18f4520)
T... |
C | #include "API.h"
#include <ifaddrs.h>
#include <sys/ipc.h>
#include <sys/shm.h>
typedef struct photo_{
int photo_id;
char ** keyword_array;//pode ter mais que uma keyword
char * photo_name;
struct photo_ *next;
} photo;
typedef struct photo_memory_{
photo *firstPhoto;
photo *lastPhoto;
} photo_memory;
photo_me... |
C | #include<stdio.h>
struct a{
int a_a;
int b_b;
int c_c;
};
struct A{
int a;
int b;
int c;
struct a aaaa;
struct a *aa;
};
struct name{
char sei[5];
char mei[5];
};
struct line{
struct name Name[5];
};
int main(){
struct A A_[10];
struct A *A__ = A_;
for(int i=0;i<10;i++){
A_[i].a = i;
A_[i].b = i;
... |
C | //
// main.c
// lab5_task1
//
// Created by Hamza Rehman on 10/20/19.
// Copyright © 2019 Hamza Rehman. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 10
typedef struct{
char *str;
} STRING;
STRING *file_read(int *n);
void sort_string(STRING *list, int n);
in... |
C | #include<stdio.h>
#include<conio.h>
main()
{
int m,n,i,j,k,a[10][10],b[10];
clrscr();
printf("ENTER THE DIMENSIONS OF THE MATRIX :\n");
scanf("%d%d",&m,&n);
printf("ENTER THE ELEMENTS\n");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
printf("\na[%d][%d]= ",i,j);
scanf("%d",&a[i][j]);
... |
C | #include "apue.h"
#include <sys/wait.h> // waitpid()
#include <unistd.h> // getcwd()
#include <sys/param.h> // MAXHOSTNAMELEN
#include <time.h> // localtime()
#include <limits.h> // LOGIN_NAME_MAX
int cuserid();
int main(void)
{
char buf[MAXLINE];
char hostname[MAXHOSTNAMELEN];
pid_t pid;
int status;
char *cwd;
... |
C | #include "binary_trees.h"
#include "111-bst_insert.c"
/**
* balance_avl - balance a node and two nodes below it
* @node: pointer to the tree to rotate
* Return: pointer to the new root node
*/
avl_t *balance_avl(avl_t *node)
{
if (!node->right && !node->left)
return (node);
if (!node->right)
{
if (!node->le... |
C | //
// Created by Hugor Chau on 9/28/20.
//
#include "../../../Include/doom_nukem.h"
#include "../../../Include/map_struct.h"
#include "../../../Include/renderer.h"
void check_player_place(t_data *data)
{
uint32_t i;
t_vec2 position;
char flag;
static int j = 0;
i = 0;
flag = FALSE;
position = data->engi... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* op_utils.c :+: :+: :+: ... |
C | #include "satUtils.h"
/**
* spec: créé et initialise la structure Sat.
* renvoie le pointeur de la structure.
* auteur: Thomas Rieffel
* verificateur: ??
* complexité: O(1)
*/
Sat* createSat(){
Sat *s = malloc(sizeof(Sat));
s->clausesCount = 0;
s->differentsVerticesCount = 0;
s->clauses = malloc(... |
C | /*
Aluno: Mateus Orsoni Cabral
RA: 147349
Disciplina: MC202 turma H
Os nomes de variáveis e de funções são eventualmente escritos em inglês apenas por uma questão de costume.
Os comentários ao longo do código serão sempre em português.
*/
#include "lista.h"
/* Funções que capturam as entradas do teclado e realizam a... |
C | /**
* @file ccnsyncslice.c
* Utility to use the Sync library to create or delete sync configuration slices.
*
* A CCNx program.
*
* Copyright (C) 2012 Palo Alto Research Center, Inc.
*
* This work is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License ver... |
C | /*
* This is the file in which you will implement the functionality required by
* the assignment. Make sure to add your name and @oregonstate.edu email
* address below:
*
* Name: Reed Boeshans
* Email: boeshanr@oregonstate.edu
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "students.h... |
C | #include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "jcomp.h"
ulong arg_read_ulong(char *start, char **end)
{
char *s = start;
long result = 0;
if (*s != '+') {
fail("parse failed looking for '+'");
}
s++;
... |
C | /*
created by premal upadhyay
*/
#include<stdio.h>
#include<conio.h>
int main()
{
printf("New Line is \n\n");
printf("Tab is \t\t premal");
return 0;
} |
C | /*
** EPITECH PROJECT, 2018
** print_help
** File description:
** Leo Fabre
*/
#include "navy.h"
void print_help(void)
{
my_printf("USAGE\n");
my_printf("\t./navy [first_player_pid] navy_positions\n");
my_printf("DESCRIPTION\n");
my_printf("\tfirst_player_pid: only for the 2nd player. pid of the first ... |
C | /*
jat0307
server
sends and receives files
*/
#include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <netinet/in.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#define port 5001 //port number
#define BUFFER 1024 //buffer size
int main()
{
int n, i, soc, nsoc, cli, active = 1;
char ch,... |
C | //
// Created by Jorge Muehlebach on 2019-09-11.
//
#include <stdio.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#include "tester.h"
/**
* checks if the card is ... |
C | /* Generated by re2c */
#include <math.h>
#include <stdio.h>
static double lex(const char *YYCURSOR)
{
const char *YYMARKER, *h1, *h2, *l1, *l2, *e1, *e2, *n;
long e = 0;
double d = 0;
const char *yyt1;const char *yyt2;const char *yyt3;const char *yyt4;const char *yyt5;const char *yyt6;const char *yyt7... |
C | #include "Port.h"
#include "Dio_Regs.h"
/*Important Note
* PORT driver in normal has more functions , but I minimize the functions due to the project
*
* */
/***************************************************
* Name: SetPortDirection
* Parameters (in): ConfigPtr -Pointer to data
* Return value: Non... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* graph_list_for_all_vert.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
for(int i=0; i<256;) {
int c = rand() % (' ' - '~') + ' ';
if(c!='"' && c!='\\') {
putchar(c);
++i;
}
}
puts("");
return 0;
}
|
C | /* @(#) File name: fmul64.c Ver: 3.1 Cntl date: 1/20/89 14:25:39 */
static char copyright1[] = "Copyright (c) Motorola, Inc. 1986";
#include "functions.h"
#include "float.h"
ULONG fmul64(ULONG ahi,ULONG alo,ULONG bhi,ULONG blo,
ULONG *desthi,ULONG *destlo,ULONG rnd,ULONG prec)
{
ULONG g,r,s,flag;
... |
C | /* c11_022.c - naive single linked list, using an array.
*
* C11_022 - single linked lists
*
* Copyright (C) 2000 Richard Heathfield
* Eton Computer Systems Ltd
* Macmillan Computer Publishing
*
* This program is free software; you can redistribute it
* and/or mo... |
C | #include<stdio.h>
int main()
{
unsigned int a,b,c;
while(scanf("%d%d%d",&a,&b,&c) != EOF)
if(a > b && a > c)
if(b > c)
printf((a > (b+c))?"A\n":"B\n");
else
printf((a > (b+c))?"A\n":"C\n");
else if(b > a && b > c)
if(a > c)
printf((b > (a+c))?"B\n":"A\n");
else
printf((b > (a+c))?"B... |
C | // UCLA CS 111 Lab 1 command reading
#include "command.h"
#include "command-internals.h"
#include "alloc.h"
#include "stack.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
const int INITIAL_TOKEN_SIZE = 50;
const int CHAR_EMPTY = -2;
static int count = 0;
void copy(struct command *so... |
C | #include <stdio.h>
/*Faça um programa para ler o horário (hora, minuto e segundo) de início e a duração, em segundos, de uma experiência biológica. O programa deve informar o horário (hora, minuto e segundo) de termino da mesma.*/
int main(void) {
int hi, mi, si, sd;
printf("Quando começou o experimento?(hh:mm:ss)\... |
C | #include<stdio.h>
main()
{int N,i ;
for(N=2 ; N<=255 ; N++)
{ i=2 ;
while (N%i!=0 && i<N )
i++ ;
}
printf("les entiers naturels premier N entre 1 et 255 sont %d\n",N);
system("pause") ;
}
|
C | #include <stdio.h>
#include <stdlib.h>
/**
* main - a program that multiplies two numbers
* @argc: argument that counts argument input
* @argv: argument the strings in an array of char*
*
* Return: 0
*/
int main(int argc, char *argv[])
{
int num1, num2, mul;
if (argc != 3)
printf("Error\n");
else
{
num1 = atoi(argv[1]... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define big long long
int *gen_rand_alt(int *s, int n)
{
int i;
for (i=0;i<n;i++)
s[i] = (rand() % n);
return s;
}
big *preprocess(int *partitionnumbers, big *list)
{
//list goes from 0 to 100, we want preprocess to as well, int... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exec_tools.c :+: :+: :+: ... |
C | /* example-8.2 */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void) {
char st[100];
int i,n,c_l,c_u,c_d;
printf ("文字列を入れてください ");
gets(st);
n=strlen(st);
c_l=c_u=c_d=0;
for(i=0;i<n;i++) {
if (islower(st[i])) c_l++;
if (isupper(st[i])) c_u++;
if (isdigit(st[i])) c_... |
C | /**
* @file cmf_object.h
*
* @brief cmf node/object APIs.
*
* @author Forrest.zhang
*/
#ifndef FZ_CMF_OBJECT_H
#define FZ_CMF_OBJECT_H
/* cmf node magic number */
#define CMF_NODE_MAGIC 0x13579BD0
/* cmf node type */
enum
{
CMF_PATH,
CMF_SINGLE,
CMF_TABLE,
CMF_ATTR,
CMF_EXEC,
CMF_DIAG,
};
/* cmf node ... |
C | /////////////////////////////////////////////////////////////////////////////////////////
//
// Battery Methods
//
// We have a standard of status for all batteries, as a simple way of knowing how to handle them.
// They are a system of ints, and are defined as follows:
// - 0: All good /... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
extern int errno; // system error number
void syserr(char * msg) // report error code and abort
{
fprintf(stderr,"%s: %s", strerror(errno), msg);
//abort(errn... |
C | #include<stdio.h>
int main()
{
char a,b,c;
scanf("%c %c %c",&a,&b,&c);
printf("%c,%c,%c",a,b,c);
}
|
C | /*
** EPITECH PROJECT, 2019
** print_option.c
** File description:
** print game option
*/
#include "my.h"
#include "tetris.h"
void print_escape_sequence(char *str)
{
int i = 0;
while (str[i] != '\0') {
if (str[i] == 27)
my_putstr("^E");
else
my_putchar(str[i]);
... |
C | /*
Author: Abraham Saiovici
Specs: https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html
*/
#include "jclass.h"
int read_class(jclass *class, char *file_name)
{
FILE *f = fopen(file_name, "rb");
if (!f) {
printf("Error. Could not read from %s\n", file_name);
return 0;
}
unsigned int magic = (unsig... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define NMax 300
int main()
{
int n;
printf("Insert the number of strings!\n");
scanf("%d", &n);
char *s=(char*)malloc(sizeof(char)*NMax);
int maxLength=0;
char *maxLengthString=(char*)malloc(sizeof(char)*NMax);
printf("Insert the... |
C | #include <stdio.h>
#define MAX_SIZE 10
typedef struct {
int data[MAX_SIZE];
int front;
int rear;
}_queue;
char isEmpty( _queue Q ){
if( Q.rear == Q.front ){
return 0;
}else
return -1;
}
char isFull( _queue Q ){
if( Q.rear == MAX_SIZE ){
return 0;
}else
return -1;
}
void add( _queue * Q, int data ... |
C | #include"queue.h"
#include<malloc.h>
#include<stdio.h>
#include <string.h>
#include "debug.h"
//Queue *pqueue = NULL;
Queue *QueueHead = NULL;
Queue *queuehead = NULL; //add by mo 2020.07.11
/*һն*/
Queue *InitQueue()
{
Queue *pqueue = (Queue *)malloc(sizeof(Queue));
if(pqueue!... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct node
{
int info;
struct node *link;
} node;
node *front=NULL,*rear=NULL;
void enqueue(int cap)
{
node *n;
n=(node*)malloc(sizeof(node));
printf("Enter number to insert in node\n");
scanf("%d",&n->info);
n->link=NULL;
... |
C | #include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
struct _num_st {
int start;
int end;
};
void *t_function(void *data)
{
int cnt, sum=0;
struct _num_st *id;
id = (struct _num_st *)data;
// printf("id->start = %d, id->end = %d\n", id->start,... |
C | #include "holberton.h"
/**
* _memset - this function modify the memory of a pointer.
* @s: pointer to modify.
* @b: character to insert.
* @n: number of bytes to modify.
* Return: modify buffer.
*/
char *_memset(char *s, char b, unsigned int n)
{
unsigned int a;
for (a = 0; a < n; a++)
s[a] = b;
return (s);... |
C | /*
Date : 14-2-2021
Aim : census structure
Source : ansi c e10.12
*/
#include <stdio.h>
#include <stdlib.h>
struct Census
{
char city[15];
long int population;
float literacy;
};
void readCities(struct Census c[], int n);
void printCity(struct Census[], int);
int compareName(const struct Census*, con... |
C | #include "lcd_1602.h"
static void delay_us(uint32_t delay){
delay*=32;
while(delay--);
}
static void lcd_send_4bit(uint8_t data)
{
/* sending 4-bits to the 4 pins of lcd*/
if(data & 0x10) d4(1); else d4(0); // 0x10 == 0b10000
if(data & 0x20) d5(1); else d5(0); // 0x20 == 0b100000
if(data & 0x40) d6(... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include "stdio.h"
int main() {
char palavra[] = "Laranja e muito normal!!!";
int i, array[20] = { 1, 3 };
for (i = 0; palavra[i] != '!'; i++) {
printf("%c", palavra[i]);
}
printf("\n");
return 0;
}
|
C | #include <math.h>
#include <assert.h>
int isPowerOfThree(int n) {
if(n <= 0)
return 0;
int MAX_POWER_OF_THREE = (int)pow(3, 19);
if(MAX_POWER_OF_THREE % n ==0)
return 1;
return 0;
}
int main() {
assert(isPowerOfThree(-3) == 0);
assert(isPowerOfThree(27) == 1);
assert(isPowe... |
C | #include "brian.h"
VOID
PrintLargeInteger (
IN PLARGE_INTEGER LargeInt
)
{
printf( "%08lx:%08lx", LargeInt->HighPart, LargeInt->LowPart );
return;
}
ULONG
AsciiToInteger (
IN PCHAR Ascii
)
{
BOOLEAN DoHex = FALSE;
LONG Integer = 0;
PCHAR c;
while (*Ascii) {... |
C | // Copyright (c) 2015 Nuxi, https://nuxi.nl/
//
// SPDX-License-Identifier: BSD-2-Clause
#include <errno.h>
#include <pthread.h>
#include <stdbool.h>
#include <testing.h>
#include <time.h>
TEST(pthread_cond_timedwait, timedout) {
pthread_mutex_t mutex;
ASSERT_EQ(0, pthread_mutex_init(&mutex, NULL));
pthread_con... |
C | #include<stdio.h>
#include<stdlib.h>
struct Date
{
int day;
int month;
int year;
};
struct Student
{
int st_roll_number;
float st_marks;
float st_attendance;
struct Date st_date_of_birth;
};
/*definition of instance variable*/
struct Student s1={10,56.78,80.96,{23,4,1995}};
/*Definition of instance of struc... |
C | #include <stdio.h>
#include <windows.h>
#include <conio.h>
void clrscr(int x, int y, char c); // ڸ ϴ ڷ ä
void gotoxy(int x, int y); // move cursor to (x, y)
#define ScreenWidth 80
#define ScreenHeight 24
// Relative coordinate with respect to the center position
int Block_x[4][4] = { // x coordinates
{ -1, 0... |
C | //Created by Rahul Goel
#include <stdio.h>
#include <math.h>
const double pr = 0.00000001;
const double pi = 3.141592653589;
int main()
{
double a, h, x;
scanf("%lf %lf %lf", &a, &h, &x);
if(x<pr)
printf("%0.10lf\n", 180.0);
else if((double)x - (double)a*a*h/2 > -pr)
{
double value =... |
C | #include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<stdlib.h>
#include<errno.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#define MAXBUF 1024
#define QUEUE_NO 5
int main(int argc,char **argv){
int sockfd,clientfd,port,int_to_receive,int_to_send,two_x,x_sq,sum;
struct sockaddr_in s_addr,c_addr;
char buff... |
C | #include<stdio.h>
int main()
{
int i,count=0;
char s[100];
gets(s);
for(i=0;s[i]!=0;i++)
{
if(s[i]==' ')
count=++count;
else
count=count;
}
printf("number of spaces:%d",count);
return 0;
}
|
C | #include <stdio.h>
int fact(int n){
int i=0,fact=1;
for(i=1;i<n+1;i++){
fact=fact*i;
}
return fact;
}
int main(){
int f,n;
scanf("%d",&n);
f=fact(n);
printf("%d",f);
return 1;
} |
C | #include "allonet/math.h"
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "mathc.h"
allo_vector allo_vector_subtract(allo_vector l, allo_vector r)
{
return (allo_vector){{
l.x - r.x,
l.y - r.y,
l.z - r.z
}};
}
allo_vector allo_vector_add(allo_vector l, allo_vector r... |
C | /*
Written by Sam Keller, Simon Montague, and Will Herold
Written on 10/25/2011
This is our main function that tests our parser
*/
#include <stdio.h>
#include <stdlib.h>
#include "parser.h"
int main(){
//make a linked list
LinkedList* tokens = malloc(sizeof(LinkedList));
LinkedList* tokenized = mal... |
C | #include "frames.h"
#include "bits.h"
#include "stream.h"
#include <string.h>
void frames_init(frames_t* frames)
{
buffer_init(&(frames->buffer), sizeof(frame_t));
}
void frames_release(frames_t* frames)
{
buffer_release(&(frames->buffer));
}
void frames_add(frames_t* frames, const frame_t* in)
{
frame_t* temp ... |
C | /**
* @file ler_interface.h
* @author André Santos, Helena Alves, Ricardo Branco
* @date ??
*/
#ifndef _LER_LOCALIDADE_H
#define _LER_LOCALIDADE_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "erros.h"
#include "lista_ligada.h"
#include "tabela_hash.h"
#include "interface.h"
#include "inter... |
C | // MDULE LOCATION
// /sys/module/<module_name>/parameters
// example: echo "1">/sys/module/simple/parameters/debug
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define PID_LOCATION "/sys/module/signal_module/parameters/pid"
#define BUFF_LE... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <.2014021_2014012.FileSystemAPI.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
/*
File System Offsets in Bytes
*/
#define superOffset 0 * 1024
#define inodeBitmapOffset 4 * 1024
#define dataBitmapOffset 8 * ... |
C | /**********************************************************************************************
*
* 结束线程:结束线程通常是由该线程自身发起的。
* pthread_exit(void *retval);
* 以阻塞的方式等待thread指定的线程结束。
* int pthread_join(pthread_t thread, void **retval);
*
***************************************************************************************... |
C | #define int ElemType
typedef struct StackSq{
ElemType *stack;
int top;
int MaxSize;
}StackSq;
void InitStack(StackSq *S,int ms)
{
if(ms<0){
printf("ms is invalid!\n");
exit(1);
}
S->MaxSize = ms;
S->stack=malloc(S->MaxSize*sizeof(ElemType));
if(!S->stack){
printf("no space!\n");
exit(1);
}
s->top = -... |
C | /* Using structure pointer without dynamic memory
*/
#include <stdio.h>
struct Person {
char name[20];
int age;
char addr[100];
};
int main()
{
struct Person p1;
struct Person *ptr;
ptr = &p1; // allocate memory address of p1 into ptr
ptr->age = 30;
printf("age: %d\n", p1.age);
... |
C | /**
* Copyright (c) 2013 by Tapti Palit, Kaustubh Gharpure. All rights reserved.
*/
#include<syscall.h>
#include<stdlib.h>
#include<common.h>
#include<stdarg.h>
#include<stdio.h>
static char char_buffer[1024]; /* Temporary block to use. */
static char final_buffer[1024]; /* This will be sent to the kernel to be pri... |
C | #include <stdio.h>
/* strcpy1: copy string 't' to string 's'. (array subscript version) */
int strcpy1(int *s, int *t)
{
int i;
i = 0;
while ((s[i] = t[i]) != '\0')
i++;
}
/* strcpy2: copy string 't' to string 's'. (pointer version 1) */
int strcpy2(int *s, int *t)
{
while ((*s = *t) != '\0')
{
s++... |
C | void readarray(int b[],int m)
{
int i;
for(i=0;i<m;i++)
{
scanf("%d",&b[i]);
}
}
void printarray(int b[],int m)
{
int i;
for(i=0;i<m;i++)
{
printf("%d ",b[i]);
}
}
int sumarray(int c[],int k)
{
int i,sum=0;
for(i=0;i<k;i++)
{
sum+=c[i];
}
return sum;
}
|
C | /*
ID: huajian2
LANG: C
TASK: butter
*/
#include <stdio.h>
#include <stdlib.h>
#define INFINIT 300000
#define MAXN 800
int c, p, e;
int pasture[MAXN];
int total_dis[MAXN];
int dis[MAXN][MAXN];
int main() {
FILE *fin = fopen ("butter.in", "r");
FILE *fout = fopen ("butter.out", "w");
int i, j, k;
i... |
C | /* ---------------------------------------------------------------------------- */
/* Copyright Digital TV Labs 2012 - 2013 */
/* ---------------------------------------------------------------------------- */
/* HTR 6.2.5: Change of CICAM_ID
* Script name: license_625.c
* Preconditions:
*
* Description:
* - T... |
C | //ifdef.c -- wykorzystuje kompilacje warunkowa
#include <stdio.h>
#define TYLKO_SPRAWDZAM
#define GRANICA 4
int main(void)
{
int i;
int suma = 0;
for (i = 1; i <= GRANICA; i++) {
suma+= 2*i*i + 1;
#ifdef TYLKO_SPRAWDZAM
printf("i=%d, suma = %d\n", i, suma);
#endif
}
printf("Suma konc... |
C | void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
}
byte i;
void loop()
{
for(i=9;i>=2;i--)
{
digitalWrite(i, HIGH);
delay(100); // Wait for 1000 millisecond(s)
di... |
C | // String a. Program to half your name into two and reverse it eg RAKESH will become KARHSE.
#include<stdio.h>
#include<string.h>
void reverse(char s[]);
int main()
{
char str[50];
printf(" Enter a string to divide hald and print in reverse order \n");
gets(str);
reverse(str);
getch();... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.