language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <arpa/inet.h>
#include <errno.h>
#include <libgen.h>
#include <netdb.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include "common.h"
#include "tcpd_interface.h"
#de... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
int main()
{
/* open source file*/
int src = open("ex1.txt", O_RDONLY);
if (src == -1)
{
printf("Error in opening the file 'ex1.txt'\... |
C | #include <linux/module.h> // Necessary include for kernel modules
MODULE_LICENSE("GPL"); // Could be any other license as well
MODULE_AUTHOR("Author Name"); // Your name
MODULE_DESCRIPTION("Short description"); // Concise summary
MODULE_VERSION("0.01"... |
C | #include <stdio.h>
int element(int arr[10], int n){
return arr[n];
}
void put(int arr[10], int n, int index){
arr[index] = n;
}
int count_vowels(char arr[10]){
int count =0;
int vowels[5] = {'a','e','i','o','u'};
for(int i=0;i<10;i++){
for(int j=0;j<5;j++){
if(vowels[j] == arr[i]){
count++;
}
... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include<math.h>
#define TABLESIZE 5077
typedef struct linkedList {
char data[35];
float score;
struct linkedList * prev;
struct linkedList * next;
}LIST;
typedef struct HashTable {
int isActi... |
C | /***********************************************************
> File Name: dup.c
> Author: Kwong
> Mail: khheng0@gmail.com
> Created Time: 2021年01月25日 星期一 21时47分50秒
> Modified Time:2021年01月25日 星期一 22时09分55秒
*******************************************************/
#include <stdio.h>
#include <stdlib.h>
#inc... |
C | #include <stdio.h>
#include <stdlib.h>
void permute(float* a, float* b, float* c)
{
float d;
if (*b > *a)
{
d = *b;
*b = *a;
*a = d;
}
if (*c > *a)
{
d = *c;
*c = *a;
*a = d;
}
if (*c > *b)
{
d = *c;
*c = *b;
*b = d;
}
}
int main()
{
float a, b, c;
do
{
printf("\n Entrez un nombre:")... |
C | #include <stdio.h>
#include "debug.h"
#include "utils.h"
#ifdef DUMP_ENABLE
void worddump(const word_t *a) {
printf("Length : %d [ ", a->length);
for (int i = 0; i < a->length; i++) {
printf("%u ", a->chars[i]);
}
printf("]\n");
}
static void dump_term(term_t *t) {
worddump(t->word);
p... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
float c, l, a, v;
printf("Digite o valor do comprimento:\n");
scanf("%f", &c);
printf("Digite o valor da largura:\n");
scanf("%f", &l);
printf("Digite o valor da altura:\n");
scanf("%f", &a);
v = c*l*a;
printf("O volume da caixa e:... |
C | int Frac10(void)
{
int i, N=1000000, l=N/10-1;
long int x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x;
clock_t begin, end;
double time;
FILE *pf;
pf=fopen("datos.dat","a");
x1 = 0;
x2 = 0;
x3 = 0;
x4 = 0;
x5 = 0;
x6 = 0;
x7 = 0;
x8 = 0;
x9 = 0;
x10 = 0;
begin... |
C | /*
* MSU CUDA Course Examples and Exercises.
*
* Copyright (c) 2011 Dmitry Mikushin
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising
* from the use of this software.
* Permission is granted to anyone to use thi... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#define PORT 4455
int main()
{ int ClientSocket;
struct sockaddr_in serveraddr;
char buffer[1024];
ClientSocket=socket(PF_INET,SOCK_STREAM,0);
memset(&serveraddr,'\... |
C |
int main()
{
struct br
{
char id[10];
int age;
} *patients,t;
int n,i,j;
scanf("%d",&n);
patients=(struct br *)malloc(sizeof(struct br)*n);
for (i=0; i<n; i++) {
scanf("%s%d", patients[i].id, &patients[i].age);
}
for (i=0; i<n; i++) {
for (j=n-1; j>i; j--) {
... |
C | /**
* This file is I/O redirection interface for Hank Shell.
* @author: Henry Huang
* @date: 09/15/2010
*/
#include "hsh.h"
//===================================================================//
// //
// Global Data Structures //
// //
//=====================... |
C | #include <stdio.h>
#include <errno.h>
int main() {
FILE *f = fopen("/etc/passwd", "r");
if (f == NULL) {
// handle error
fprintf(stderr, "File opening failed: %d\n", errno);
return 1;
}
// ...use the file...
fclose(f);
return 0;
}
|
C | #include<stdio.h>
#include<unistd.h>
#include<malloc.h>
int main()
{
int i,k;
printf("My process ID : %d\n", getpid());
int *ptr = (int *) malloc(sizeof(int)* 1024*10);
while(1)
{
for(i=0; i<1024*10; i++)
{
*(ptr+i) = *(ptr+i) * 1;
}
printf("Enter a int value to proceed:\n");
scanf("%d",&k);
}
}
|
C | /*
============================================================================
Name : Projet-C-Exia-2014.c
Author : Vadorequest
Copyright : MIT
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include "_include.h"
/**
* Disp... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* config_reader.c :+: :+: :+: ... |
C | #ifndef STD_TERMINAL_H
#define STD_TERMINAL_H
#include <std/std_base.h>
#include <stdint.h>
__BEGIN_DECLS
/// Hardware text mode color constants
typedef enum term_color {
COLOR_BLACK = 0,
COLOR_BLUE = 1,
COLOR_GREEN = 2,
COLOR_CYAN = 3,
COLOR_RED = 4,
COLOR_MAGENTA = 5,
COLOR_BROWN = 6,
COLOR_LIGHT_GREY = 7,... |
C | #include "./lower.h"
char to_lowercase(char c) {
if (c >= 'A' && c <= 'Z') {
return c + ('a' - 'A');
} else {
return c;
}
}
|
C | /*
Mr.Punyawat Jaroensiripong 6313133 EGCO
นายปุญญาวัฒน์ เจริญศิริพงศ์ 6313133 EGCO
*/
#include <stdio.h>
#include <stdlib.h>
#include "bubble.h"
int main(int argc, char *argv[]){
int *a,N;
printf("How many numbers do you have : ");
scanf("%d",&N);
a = (int *) malloc(N*sizeof(int));
for(int ... |
C | /*
* Copyright (c) 2009, Stathis Kamperis
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of co... |
C | #include "stdio.h"
#include "stdlib.h"
struct node
{
struct node *left;
struct node *right;
int info;
};
//PADDING AND STRUCTURE are print functions
//TAKEN FROM USER NARUE ON https://www.daniweb.com/programming/software-development/threads/146112/printing-a-binary-tree
void padding ( char ch, int n )
{
int i;... |
C | /*
** EPITECH PROJECT, 2018
** error.c
** File description:
** error
*/
#include "main.h"
int error_step(int ac, char **av)
{
if (ac != 2) {
my_putstr("Bad number of arguments !\n");
return (1);
}
else if (ac > 1 && av[1][0] == '-' && av[1][1] == 'h') {
my_putstr("Finite Runner created with CSFML\n\n");
my... |
C | //TODO = Ver si es necesario definirlo a fuera del client.c
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdbool.h>
#include <malloc.h>
#include <stdlib.h>
#include "server_definitions.h"
#include "file_functions.h"
static const char *EXIT_CMD = "exit";
static const char... |
C | #ifndef FILE_H
#define FILE_H
/* Tags the program checks for in the file */
#define LEFT_PARENTHESIS '('
#define RIGHT_PARENTHESIS ')'
#define LEFT_BRACKET '['
#define RIGHT_BRACKET ']'
#define LEFT_BRACE '{'
#define RIGHT_BRACE '}'
/* Comments to check for in the file */
#define POUND_SIGN '#'
#define FORWARD_S... |
C | /********************************************************************
* Purpose:
* Given an open .fa file, parse through it and determine the
* length of the chromosome. This is accomplished by getting
* the size of the file (skipping the header), and subtracting
* the number of newline characters (minus 2 for... |
C | #include <stdlib.h>
#include <stdio.h>
// Program is designed to create one block of variant in size
struct mytuplerecorder
{
int *addr;
size_t len;
};
int main()
{
int *ptr[1000];
struct mytuplerecorder tr;
int blocksize;
printf("Please enter your choice of function:");
printf("\n 1: For malloc2 \n");
... |
C | #include "graphics.h"
#include "extgraph.h"
#include "genlib.h"
#include "simpio.h"
#include "conio.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <windows.h>
#include <olectl.h>
#include <mmsystem.h>
#include <wingdi.h>
#include <ole2.h>
#include <ocidl.h>
#include <winuser.h>
#include "imgui... |
C | /****************************************************************
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.... |
C | #include <stdio.h>
#define LINE_LENGTH 8
int main(int argc, char *argv[])
{
char ch;
int count;
count = 0;
while ((ch = getchar()) != '#') {
printf("%5d", ch);
count++;
if (count == 8){
printf("\n");
count = 0;
}
}
printf("\n");
return 0;
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include <assert.h>
#include "Calculator.h"
#include "CalcSymbols.h"
#include "CalcStack.h"
#include "CalcTypes.h"
static FILE* pCalculatorOutputStream =0;
static FILE* pCalculatorMessageStream =0;
const char* asString(const CL_... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(int argc, char *argv[])
{
char a=150;
char b=200;
char c=a+b;
int d= (150+200)&0xff;
printf("c=%d\n",c);
printf("d=%d\n",d);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
int* addToArrayForm(int* A, int ASize, int K, int* returnSize)
{
int kSize = 0;
int kNum = K;
while (kNum)//Kij
{
++kSize;
kNum /= 10;
}
int len = ASize > kSize ? ASize : kSize;//жAKĴСԴΪ
int*retArr = (int*)malloc(sizeof(int)*(len + 1));//ռ
//˼룺AK λ 9ǰһλ1
int Ai = ASiz... |
C | #include <stdio.h>
int main() {
//khai bao bien
int n,i,Tong=0;
printf("Nhap n : ");
scanf("%d", &n);
//Tao mang a kich thuoc n
int a[n];
//Nhap n phan tu cua mang a tu ban phim
for(i = 0;i < n;i++){
printf("Phan tu o mang a thu %d : ",i);
scanf("%d", &a[i]);
}
//Hien thi cac phan tu cua man... |
C | # Zoho-assignments.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void printarray(int order,int *puzzle[])
{
int i,j;
for(i=0;i<order;i++)
{
for(j=0;j<order;j++)
{
if(puzzle[i][j]!=0)
{
printf("%d ",puzzle[i][j]);
}
else
{
char a=' ';
printf("%c ",a);
}
}
printf("\n"... |
C | #include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
int main(int argc, char* argv[]){
pid_t child_1= fork();//fork a child
int child1_exit_code;
int child2_exit_code;
if(child_1==0){//first child process
printf("I am child one, my pid is: %d \n", getpid());
}
else{//parent pr... |
C | /*
---------------------------------------------------------------------------------------------------
用三种方式打印九九乘法表
----------------------------------------------------------------------------------------------------
*/
#include<stdio.h>
void PrintTableVersion1();
void PrintTableVersion2();
void PrintTableVersi... |
C | //#define _GNU_SOURCE
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "xmlrpc_config.h" /* For HAVE_ASPRINTF, __inline__ */
#include "xmlrpc-c/string_int.h"
static __inline__ void
simpleVasprintf(char ** const retvalP,
const char * const fmt,
va_list ... |
C | #include<stdio.h>
int main() {
int i,j,n=2;
for (i = 2; i < 100; i++) {
for (j = i; j < 100;j++)
if (j%i!=0) {
printf("%d ", j);
}
}
} |
C | /**
* C: 邻接矩阵表示的"有向图(Matrix Directed Graph)"
*
* @author skywang
* @date 2014/04/18
*/
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#define MAX 100
#define isLetter(a) ((((a)>='a')&&((a)<='z')) || (((a)>='A')&&((a)<='Z')))
#define LENGTH(a) (sizeof(a)/sizeof(a[0]))
// 邻接矩阵
ty... |
C | #include "WaitFreePool.h"
#include "commons.h"
#include "StackPool.h"
#include "QueuePool.h"
#include "Stack.h"
#include "Chunk.h"
#include "LocalPool.h"
#include "FreePool.h"
#include "FullPool.h"
#include "SharedPools.h"
#include <assert.h>
#include "HazardPointer.h"
#include "StackArray.h"
typedef struct {
AtomicS... |
C | /* Copyright (c) 2017 Foudil Brétel. All rights reserved. */
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
#include "utils/cont.h"
#include "utils/rbtree.h"
/* Define a rbtree type. */
struct foo {
struct rbtree_node node;
uint32_t key;
};
/* We MUST provide our own key compari... |
C | #include<stdio.h>
#include<stdlib.h>
void swap(int* a,int* b);
int partition(int arr[],int start,int end);
void quick_sort(int arr[],int start,int end);
void display(int arr[],int size);
int binary_search(int key,int arr[],int low,int high);
int main(void){
int arr[] = {34,21,90,11,23,7,56,89,45,67};
int arr_... |
C | #ifndef _LEETCODE_HASH_
#define _LEETCODE_HSAH_
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include "LeetCodeBox.h"
#define HASH_MODULO 101
#define P_A 3
#define P_B 7
typedef struct hashListNode {
char* str;
uint value;
struct h... |
C | //##************************
//##* This source code is licensed under the terms and conditions of the BSD license,
//##* the full text of which can be found in the file named 'License.txt' that
//##* accompanies this code. (C) copyright Geoffrey French 1999-2010.
//##************************
#ifndef AXIS_H__
#define AX... |
C | #include "binary_trees.h"
/**
* binary_tree_depth - measures the depth of a node in a binary tree
*
* @node: pointer to the node to measure the depth
* Return: depth of tree
*/
size_t binary_tree_depth(const binary_tree_t *node)
{
size_t depth = 0;
if (!node)
return (0);
while (node->parent)
{
depth += ... |
C | /*
Nome: Amanda Gonçalves Dias
NUSP: 10275312
Turma: Projeto de Algoritmos SCC5900
Data Entrega: 25/03/2017
*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void trocar_linhas(double **A, int linhaVelha, int linhaNova, int kA, int kB)
{
int j;
int aux;
for (j=0; j< (kA + kB); j++)
{
aux =... |
C | /*****************************
* Prekladac jazyka IF2008
* Matus Kontra (xkontr00) (veduci)
* Jozef Kobrtek (xkobrt00)
* Patrik Seben (xseben00)
* Matej Smetana (xsmeta02)
******************************/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include "bvs.h"
#inclu... |
C | /*
** EPITECH PROJECT, 2017
** Operations rotates_left
** File description:
** .c
*/
#include <stdio.h>
#include "my.h"
#include "pushswap.h"
void rotate_left(int *list, int size)
{
int count = 0;
int cpy = list[0];
while (count < size - 1) {
list[count] = list[count + 1];
count++;
}
list[size - 1] = cpy;
... |
C | #ifndef SUDOKU_SOFTWARE_PROJECT_LIST_H
#define SUDOKU_SOFTWARE_PROJECT_LIST_H
#include <stdlib.h>
#include <stdio.h>
#include "Exceptions.h"
/**List.h goal:
* This module contains all functions and structs that are related to the ability to undo or redo game moves
*
* Structs:
* struct Node ... |
C | #include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <sys/select.h>
#include "libonplatform/ocnet_thread.h"
#include "libonevent/onevent.h"
#include "libonevent/onevgrp.h"
#include "libonevent/onlfds.h"
static int g_running = 0;
static void *__evgrp_handler(void *arg)
{
ocnet_evgrp_t *evgrp = arg... |
C | #include "header.h"
byte_buffer UC_mem_alloc_2_with_size(size_t row, size_t col, BYTE Initial_value)
{
size_t i = 0;
byte_buffer res;
res.row = row;
res.col = col;
res.buf = (BYTE **)malloc(res.row * sizeof(BYTE*));
for (i = 0; i<res.row; i++) {
res.buf[i] = (BYTE *)malloc(res.col * sizeof(BYTE));
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "mpi.h"
double monteCarloPi(int n){
double x = 0;
double y = 0;
double acertos = 0;
for(int i = 0; i < n; i++) {
x = (double)(rand())/(double)(RAND_MAX);
y = (double)(rand())/(double)(RAND_MAX);
if((x*x+y*y) < 1) {
acertos++;
}
}
r... |
C | /** @file
Comparison Functions for <wchar.h>.
Unless explicitly stated otherwise, the functions defined in this file order
two wide characters the same way as two integers of the underlying integer
type designated by wchar_t.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
This... |
C | /* =============================================
IMPLEMENTATION OF CALCULATIONS HEADER
================================================ */
#import <math.h>
#import <stdbool.h>
#import <stdio.h>
#import <stdlib.h>
#include "calculations.h"
#include "string.h"
#include "lwFields.h"
#include "unistd.h"
/**
@brief cal... |
C | #ifndef FUNCIONES_H_INCLUDED
#define FUNCIONES_H_INCLUDED
typedef struct {
char nombre[50];
int edad;
int dni;
int estado;
}ePersona;
/**
* Obtiene el primer indice libre del array.
* @param lista el array se pasa como parametro.
* @return el primer indice disponible
*/
int obten... |
C | #include "style.h"
#include <simple-tiles/util.h>
#include <simple-tiles/style.h>
VALUE cSimplerTilesStyle;
static simplet_style_t *
get_style(VALUE self){
simplet_style_t *style;
Data_Get_Struct(self, simplet_style_t, style);
return style;
}
static void
mark_style(void *style){
simplet_style_t *stl = style;... |
C | #ifndef COMMAND_H
#define COMMAND_H
#include <unistd.h>
#include <stdbool.h>
#include "astree.h"
/*
** CommandInternal:
** execute_simple_command() などで利用される
** ひとつのコマンドを実行するための周辺情報をまとめて保持する
*/
struct CommandInternal
{
int argc; /* 引数の数 */
char **argv; /* コマンドライン引数の文字列を保持するダブルポインタ */
bool stdin_pipe; /* 入力の指定ディスクリプ... |
C | #include <stdio.h>
#define ROWS 3
#define COLS 4
void sum_rows(int ar[][COLS],int rows);
void sum_cols(int [][COLS],int);
int sum2d(int(*ar)[COLS],int rows);
int main(void){
int test[]={1,2,3};
int junk[][COLS]={
{2,4,6,8},
{3,5,7,9},
{12,10,8,6}
};
int (*p)[4];
p=junk;
sum_rows(junk,ROWS);
... |
C | /*
Name : Dynamic memory allocation for a 2D array in C
Author : bpg168
Date : Nov, 30, 2017
Time : 7-32am
Project : Testing
*/
#include <stdio.h>
#include <stdlib.h>
#define ROWS 10
#define COLUMNS 10
int main(int argc, char **argv){
int** twoDArray, i, j;
//------------------Memory Allocation for 2D Array----... |
C | # pragma once
const int MAX_NUM_PROBABILIDADES = 26;
struct probabilidad {
int clave;
int palabras;
double P_Descifrado;
};
/*
* Pre: ---
* Post: Ha presentado en pantalla el menú con
* las probabilidades de las claves.
*/
void menuProbabilidad(probabilidad caso[]);
/*
... |
C | #include <stdio.h>
#define MAX(a, b) ((a > b) ? (a) : (b))
int main(void)
{
float a, b, max;
printf("enter two num,i will give your the big one\n");
scanf("%f %f", &a, &b);
max = MAX(a, b);
printf("%f is the big one", max);
return 0;
} |
C | //
// main.c
// Queue
//
// Created by Anchor Ke on 2018/10/9.
// Copyright © 2018 Anchor Ke. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include "OWQueue.h"
int main(int argc, const char * argv[]) {
// insert code here...
QUEUE_HEAD Head={.FIRST = NULL,.COUNT = 0};
PACKAGE_STRUCT *Myp... |
C | /* Trap ver 2005-Jun-12
* by Joseph Larson (c) 2008
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#define MAX 100
#define MG 8
int main (void) {
int x, h, l, try, temp;
char yesno;
printf ("Trap\n----\n"
"In this game you have to try to guess a number between 1 and %d by\n"... |
C | /*
* linux/include/asm/setup.h
*
* Copyright (C) 1997-1999 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Structure passed to kernel to tell it about th... |
C | #include <stdio.h>
char *my_evil_str(char *str);
int main(void)
{
char i[50] = "HELLO";
char *ptr;
ptr = my_evil_str(i);
printf("%s\n", ptr);
return(0);
}
|
C | /*
* Copyright 1989 O'Reilly and Associates, Inc.
* See ../Copyright for complete rights and liability information.
*/
/*
* xmotdbltst.c - simple program to test getting motion events and
* double clicks in the same widget.
*/
#include <stdio.h>
/*
* Include files required for all Toolkit programs
*/
#inclu... |
C | // Implements a dictionary's functionality
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include "dictionary.h"
typedef struct node // Represents a node in a hash table
{
char word[LENGTH + 1];
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "model_game2048.h"
S_GAME2048_BOARD* F_GAME2048_NEWGAME() {
S_GAME2048_BOARD* gameboard = malloc(sizeof(S_GAME2048_BOARD));
if (gameboard == NULL) {
gameboard = F_GAME2048_NEWGAME();
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++... |
C | /*
******************************************************************************
* mm.c *
* 64-bit struct-based implicit free list memory allocator *
* 15-213: Introduction to Computer Systems ... |
C | // nlog(n) time complexity
#include <stdio.h>
int find_min(int * a,int start,int end){
int mid = (start + end)/2;
if((a[mid]<a[mid - 1])&&(a[mid]<a[mid + 1])){
return mid;
}
else if((a[start]<a[start + 1])){
return start;
}
else if((a[end]<a[end - 1])){
return end;
}... |
C | /*
** EPITECH PROJECT, 2020
** my_ls
** File description:
** ls-desu
*/
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include "my.h"
char *put_nb(int max, int nb)
{
char *tmp = (char *)malloc((max + 1) ... |
C | #include <SDL2/SDL.h>
#include "../canvas/canvas.h"
#include "../viwe/numbers/numbers.h"
typedef struct Counter {
int count;
int x, y;
void (*start)(struct Counter*, SDL_Renderer*);
} Counter;
static int* getImgForNumber(int num) {
switch (num) {
case 0:
return *zero;
case... |
C |
/*I
project: Payslip Program
Author: Ouma Ben
Date: 19,Oct,2021
Compiler: GCC
Language: C99
License: MIT
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
//variable declaration
char name[100];
int emp_no,hours;
int normal_pay,overtime_pay, gross;
float tax,net;
const... |
C | /*
* @Date: 2020-05-03 10:32:14
* @LastEditors: litelte
* @LastEditTime: 2020-05-03 10:47:14
* @FilePath: /CProject/zju_c/week3PatTask/7.c
* @Description: 计算个人所得税
*/
#include <stdio.h>
int main(int argc, char const *argv[])
{
float salary = 0;
scanf("%f", &salary);
if (salary < 0)
{
printf... |
C | /*program to find L.C.M of two numbers*/
#include<stdio.h>
main()
{
int a,b,l;
printf("enter 1st number");
scanf("%d",&a);
printf("enter 2st number");
scanf("%d",&b);
for(l=1;l<=a*b;l++)
if(l%a==0&&l%b==0)
{
break;
}
printf("L.C.M of %d And %d is : %d",a... |
C | //stack using array
#include<stdio.h>
#include<stdlib.h>
int queue[5];
int maxq=5;
int front=0;
int rear=-1;
int isfull()
{
if(rear==maxq-1)
return 1;
else
return 0;
}
int isempty()
{
if(rear== -1)
return 1;
else
return 0;
}
void enqueue(int n)
{
if(isfull())
{
printf("sorry the queue is full \n"... |
C | #include <stdio.h>
#include <cs50.h>
typedef struct Person
{
string name;
string number;
}Person;
int
main(int argc, char const *argv[])
{
Person person1;
person1.name = "Eddy";
person1.number = "12345";
printf("%s\n",person1.number);
printf("%s\n",person1.name);
return 0;
} |
C | #include<stdio.h>
#include<conio.h>
void main()
{ int a[10],i,n,key,flag=0;
printf("Enter no. of elements in the array:");
scanf("%d",&n);
printf("Enter the elements:");
for(i=0;i<n;i++)
{ scanf("%d",&a[i]);
}
printf("Enter the key to be searched for:");
... |
C | #include <stdio.h>
int obrnut(int x) {
int broj=0;
do{
broj=x%10+broj*10;
x=x/10;
} while(x>0);
return broj;
}
int main () {
int x;
printf("Unesite cijeli broj: ");
scanf("%d", &x);
printf("Obrnut broj glasi: %d", obrnut(x));
return 0;
} |
C | /* Ulises Martinez
* Program to replicate page replacement FIFO and LRU using pure demand paging
* to calculate the number of page faults. Two arrays are used to accomplish
* this. One array holds the page number of the virtual address n entered and
* the other array holds the time the page n has been in that spot.... |
C | #include<stdio.h>
int main(void)
{
struct emp
{
char name[10];
int id,age;
}e[3];
struct emp *p;
for(p=e ; p<=(e) ; p++ ) // because e is an array of structure so e contains the address that why we have used p=e
{
printf(... |
C | #include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
struct Node* next;
};
void insert_at_end(struct Node** head_ref, int data){
struct Node* current_node = *head_ref;
struct Node* new_node = (struct Node*)malloc(sizeof(struct Node));
new_node->data = data;
new_node->next = NULL;
i... |
C | //Replace ' ' with "%20"
#include <stdio.h>
int str_len(char*str);
void main()
{
char str[30]="Mr John Smith";
int length=str_len(str);
int spaces=0;
int i,j;
printf("String=%s Leg=%d\n",str,length);
for(i=0;i<length;i++)
{
if(str[i]==' ')
{
spaces++;
}
}
j=length+spaces*2;
str[j]='\0... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Programa.h"
int main (int argc, char* argv[]){
int size = 10;
int* vector = (int*)malloc(size*sizeof(int));
fill(vector, size, 5);
int teste = find(vector, size, 4);
// debug
// for (int i = 0; i < size; i++) printf("%d\n", vector[i]);
/... |
C | #include "include/keyboardDriver.h"
#include "include/videoDriver.h"
#include "kernel.h"
extern int getSeconds();
extern int getMinutes();
extern int getHours();
extern int getMonth();
extern int getYear();
typedef void (*fn)(unsigned long rsi, unsigned long rdx, unsigned long rcx, unsigned long r8, unsigned long r9... |
C | /*
============================================================================
Name : charren.c
Author : Jeffrey
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <st... |
C | void calculations (float &perimeter, float &area)
{
float initialDist = 0;
float finalDist = 0;
initialDist = SensorValue[S1];
motor[motorA] = motor[MotorD] = 20;
while(SensorValue[S2] == 3)
{}
motor[motorA] = motor[MotorD] = 0;
finalDist = SensorValue[S1];
perimeter = 4*(initialDist - finalDist);
area = ... |
C | #include<stdio.h>
#include<stdlib.h>
#include "DynamicList.h"
void list_init(list* ls)
{
ls->count = 0;
ls->capacity = LIST_INIT_CAPACITY;
ls->items = malloc(sizeof(void*) * ls->capacity);
}
int list_count(list* ls)
{
return ls->count;
}
int list_capacity(list* ls)
{
return ls->capacity;
}
static void list_r... |
C | #include <stdio.h>
#pragma warning(disable:4996)
int main()
{
const int a = 10;
int *p = &a;
*p = 20;
printf("%d\n", a);
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* matrix_transformations.c :+: :+: :+: ... |
C | #ifndef MECH423_LIB_ADC_H
#define MECH423_LIB_ADC_H
#include <msp430.h>
#include <stdbool.h> // required to use Booleans in C
// ADC variables
volatile unsigned int Adc_data_ = 0; // last read data
volatile bool Adc_converted_ = false; // flag set in ISR
#define Adc_NTC_ANALOG_PIN 4
#define Adc_ACCELEROMETER_X 12
#d... |
C | #include "Stack.h"
void Swap(int *p1, int *p2)
{
int tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
//ǰָ뷨
int PartSort(int *a, int start, int end)
{
assert(a);
int keyIndex = end;
int cur = start;
int prev = cur - 1;
while (cur <= end)
{
if (a[cur] <= a[keyIndex] && ++prev != cur)
{
Swap(&a[cur], &a[prev]);
}... |
C | //korzystając z programu dwarfdump odczytaj funkcje/symbole zawartych w bibliotece
//i uzupełnij kod w wyznaczonych miejscach aby doprowadzić do kompilacji
//interesujące nas fragmenty:
//DW_AT_name - nazwa
//DW_TAG_formal_parameter - argumenty funkcji
//DW_AT_type - typ zwracany
// typ zwracany przekierowuje nas do i... |
C | #include<stdio.h>
int main()
{
int marks[10], i, n, sum=0;
printf("Enter no of subjects : \t");
scanf("%d",&n);
for ( i =0; i<n; i++)
{
printf("Enter marks of subject %d : \t", i+1);
scanf("%d", &marks[i]);
sum = marks[i] + sum;
}
printf("sum = %d", sum);
return... |
C | /*
06:жǷΪλ
鿴 ύ ͳ
ʱ: 1000ms ڴ: 65536kB
жһǷλڵ10Сڵ99
һ1000
һСλ10
54
1
*/
#include <stdio.h>
int main()
{
int a;
scanf("%d",&a);
if (a>10 && a<100) printf("1");
else printf("0");
return 0;
}
|
C | /*
* a program to quiz on binary numbers
* generate 9 numbers between 1 - 15
* select 3 of those and sum
* display all 9 with target sum
* select 3 to match sum
*/
#include <stdio.h>
#include <stdlib.h> //for random generation
#include <time.h> //time value for seed
void displayBinary(int n, int bit_arr[],... |
C | #ifndef p1header
#define p1header
#include "p1header.h"
simple* poutsimp;
int convertfromoutsimp(simple* sp);
int main(int argc, char *argv[]){
int xcoord;
int ycoord;
xcoord= atoi(argv[3]);
ycoord= atoi(argv[4]);
ip= fopen(argv[1], "rb");
if(!ip){ goto error;
}
op= fopen(argv[2], "wb");
... |
C | #include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<pthread.h>
int chunk_size = 100;
int data[1000];
void *Add (void *arg){
int start = (int) arg;
int end = start + chunk_size;
int sum = 0;
for (int i = start ; i < end ; i++){
sum = sum + data[i];
}
return ((void*)sum);
}
int main () {
in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.